[ovs-dev] [PATCH 7/8] windefs: Add a placeholder for common definitions for windows.

Gurucharan Shetty shettyg at nicira.com
Mon Nov 18 16:42:12 UTC 2013


On Mon, Nov 18, 2013 at 8:30 AM, Ben Pfaff <blp at nicira.com> wrote:
> On Mon, Nov 18, 2013 at 07:43:28AM -0800, Gurucharan Shetty wrote:
>> windefs.h will be included inside config.h. Since config.h
>> should ideally be included by all the header files, windefs.h
>> will automatically be included while compiling on windows.
>> The file is eventually expected to have some typedefs
>> and #defines to make code compile on windows.
>>
>> Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
>
> I have mixed feelings about this because it starts to mix platform and
> compiler dependencies.  If one were to use GCC (from mingw) as the
> compiler, then the "typedef char bool;" would not help, it would
> actually prevent compiling.  In fact, I'm not sure how it helps with
> MSVC, since presumably that compiler doesn't have <stdbool.h> and will
> complain when we try to include it?

The way the windows port (which is a work in progress) is structured
right now in an internal repo is
to have the following headers in include/windows. Most of the files
are empty to prevent compiler complaints. I guess, it also helps to
prevent multiple #if WIN32 in the .c files of the upstream repo.

.
./arpa
./arpa/inet.h
./config.h
./daemon.h
./execinfo.h
./fcntl.h
./getopt.h
./inttypes.h
./lockfile.h
./net
./net/if.h
./net/if_arp.h
./net/if_packet.h
./netdb.h
./netedev.h
./netinet
./netinet/icmp6.h
./netinet/in.h
./netinet/in_systm.h
./netinet/ip.h
./netinet/ip6.h
./netinet/tcp.h
./netlink-protocol.h
./netlink-socket.h
./netlink-win.h
./ovs-ioctls.h
./poll.h
./signal.h
./signals.h
./stdbool.h
./sys
./sys/ioctl.h
./sys/resource.h
./sys/socket.h
./sys/time.h
./sys/uio.h
./sys/un.h
./sys/wait.h
./syslog.h
./timeval.h
./type-props.h
./unistd.h
./windefs.h
./winpthreads.h

Now, without those header files and some changes in the .c files, any
of the patches that I supplied in this patch series won't successfully
compile using the visual c++ compiler. My idea was mainly to send in
patches that does not hurt the compilation in any other platforms
(i.e., linux or freebsd) and also prep the structure of the upstream
repo so that other code can move in.

Do you feel that individual patches for the windows port should
compile when using the visual c++ compiler.

Also, as you mentioned, if we use gcc in mingw, that will be a
problem. Do you have a nicer idea?



More information about the dev mailing list