As some of you probably know I have been working on compiling Wine on Windows using Microsoft Visual C/C++ (MSVC). Even though it doesn't really work that well yet there have been at least some success.
Anyway recently I have began trying to get the Wine tests to compile and work using MSVC. More specifically I have been trying to get the my generated tests for data structure packing (tests/generated.c) to work. This currently works quite well. A few patches regarding errors found coming soon.
However there are at least two intresting ways to compile and run the tests on Windows. 1. Compile using the Wine headers. 2. Compile using the Microsoft headers.
Currently only (1) works in a portable way.
To get (2) to work I had to add the directory of the Microsoft includes to the begining of the include path. This is not very portable since it differs from installation to installation. I have currently hardcoding my specific directory.
The above have to be done because the Wine tests includes include/wine/test.h as thus ......\include (or similar depending on directory depth have to be added the the include). This overides the Microsoft headers!!! Microsoft C unlike GNU C have no option to avoid this other than adding the path the Microsoft include directory which as I previously mention varies depend on installation. :-)
However I finally think I have found a portable solution, that will work not only with the Wine test but also with Wine itself (eventhough that is perhaps less instresting right now).
We currently have the directory structure like
include: Wine's version of Windows headers include/wine: Wine's internal and "extension" headers
I would like to have a directory structure like
include: Wine's version of Windows headers include/wine: Wine's internal headers include/wine/wine: Wine's "extension" headers
With "extension" headers I mean that headers that are exported and usuable by Winelib applications.
This would allow me to, using MSVC, just do
/I ......\include\wine
instead of the current very ugly and unportable
/I d:\program files\microsoft visual studio\vc98\include /I ......\include
So concretely what I think needs to be done (not tested) is the following.
cd include/wine mkdir wine mv exception.h test.h unicode.h wine # Then include/Makefile.in needs to be changed accordingly as well. # In principle all the include/wine/ files named in include/Makefile.in # should be moved as well. However the files named above is enough for # the Wine tests AFAICS.
--- Make.rules.in 19 Oct 2002 17:15:00 -0000 1.131 +++ Make.rules.in 21 Oct 2002 12:58:35 -0000 @@ -45,7 +45,7 @@ LN = @LN@ LN_S = @LN_S@ TOOLSDIR = @TOOLSDIR@ -DIVINCL = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include $(EXTRAINCL) +DIVINCL = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include -I$(TOPSRCDIR)/include/wine $(EXTRAINCL) ALLCFLAGS = $(DIVINCL) $(CFLAGS) $(DEFS) $(OPTIONS) LD = @LD@ LDFLAGS = @LDFLAGS@
So what do you think?
Note that compiling Winelib applications under Linux might benefit from this as well since it makes it easier to use the real Microsoft headers together the Wine extensions (wine/*.h). Sure currently GNU C chokes on this but one day some compiler (GNU C or some other) might not...