What is the proper way to use the MSVCRT in WineLib? I tried adding a -I/usr/local/include/wine/msvcrt to the list of includes and -nostdinc to CXXEXTRA, but then gcc can't find stdarg.h, which is included in windows.h via winbase.h.
If I use -nostdinc++, gcc is able to find stdarg.h, but it runs into problems with other files, such iostream.h.
Finally, if I don't use either -nostdinc or -nostdinc++, gcc complains about types being redefined, such as wint_t (as an unsigned short int in /usr/include/_G_config.h but WCHAR in /usr/local/include/wine/msvcrt/wctype.h).
It seems like using -nostdinc would be the right way, but does that mean that Wine needs to include its own copy of stdarg.h and related files?
-Steve
--- steve.lustbader@philips.com wrote:
What is the proper way to use the MSVCRT in WineLib?
Check out how Wine programs (e.g. regedit) use MSVCRT.
Andriy
__________________________________________________ Do you Yahoo!? Yahoo! News - Today's headlines http://news.yahoo.com
Am Mon, 2002-09-16 um 20.58 schrieb steve.lustbader@philips.com:
Finally, if I don't use either -nostdinc or -nostdinc++, gcc complains about types being redefined, such as wint_t (as an unsigned short int in /usr/include/_G_config.h but WCHAR in /usr/local/include/wine/msvcrt/wctype.h).
I just stumbled into the same problem.
I worked around this by adding a few lines to the wine header files - see patch below - and at least my code compiles now. I can't tell if it runs, but it may be worth a try.
It may also depend on the gcc/libc versions installed, though :/ Perhaps someone with more insight into wide characters/libc/gcc can comment.
--nostdinc obviously carries tons of problems, I've given up on it.
Martin
Index: include/msvcrt/wchar.h =================================================================== RCS file: /home/wine/wine/include/msvcrt/wchar.h,v retrieving revision 1.3 diff -u -r1.3 wchar.h --- include/msvcrt/wchar.h 22 Oct 2001 18:59:23 -0000 1.3 +++ include/msvcrt/wchar.h 16 Sep 2002 16:25:12 -0000 @@ -24,7 +24,8 @@ #define WCHAR_MIN 0 #define WCHAR_MAX ((WCHAR)-1)
-typedef int MSVCRT(mbstate_t); +typedef int MSVCRT(__mbstate_t); +typedef MSVCRT(__mbstate_t) MSVCRT(mbstate_t);
#ifndef MSVCRT_SIZE_T_DEFINED typedef unsigned int MSVCRT(size_t); Index: include/msvcrt/wctype.h =================================================================== RCS file: /home/wine/wine/include/msvcrt/wctype.h,v retrieving revision 1.4 diff -u -r1.4 wctype.h --- include/msvcrt/wctype.h 31 May 2002 23:06:50 -0000 1.4 +++ include/msvcrt/wctype.h 16 Sep 2002 16:25:12 -0000 @@ -66,6 +66,10 @@
typedef WCHAR MSVCRT(wctype_t); typedef WCHAR MSVCRT(wint_t); +#ifndef USE_MSVCRT_PREFIX +/* prevent C++ standard library from redefining wint_t */ +#define _WINT_T +#endif
/* FIXME: there's something to do with __p__pctype and __p__pwctype */