On Sat, 2006-02-11 at 14:51 -0500, Earnie Boyd wrote:
> Get the mingw runtime source and add to crtdll.def an entry for
> _cgetws. Rebuild the source package then replace the list of libraries
> with your rebuild. Submit a patch to the patch tracker once you're
I almost did this, but then I realised that it probably wouldn't work.
My system's crtdll.dll does not contain _cgetws. The only libraries on
my system (real DLLs) that contain this function are msvcr80[d].dll.
MinGW does not have import libraries for these, as far as I can tell.
However, I discovered that recent versions of LD can link directly to a
DLL without using import libraries, so I symlinked the Microsoft DLLs
directly into /usr/i686-pc-mingw32/lib, and now I can compile against
them. Thanks for pointing me in the right direction!
I would submit a patch to add the definition for _cgetws() to MinGW's
headers, but I'm not sure exactly where it should go. MSDN says "conio.h
or wchar.h", which implies that <conio.h> can import <wchar.h>, but
MinGW's version does not appear to do so. I'm afraid to add the
prototype to <conio.h> because it relies on wchar_t, which may not be
defined by that point.
I could add it to <wchar.h>, but there is a confusing mixture of
#if[n]defs in there, and I don't know under what circumstances the
prototype should be available. Maybe just if __MSVCRT_VERSION__ >=
Now I have another problem with import libraries and autoconf (I'm sorry
if this is the wrong forum for such a question). I want to use something
like AC_SEARCH_LIBS to find an appropriate runtime to link against. I
want to link to the lowest available version of the runtime, so I use:
AC_SEARCH_LIBS([_cgetws], [msvcr71 msvcr80])
MinGW comes with import libs for msvcr71.dll, and so Autoconf detects
that it can link against that library, and chooses it. But I have no
actual msvcr71.dll on my system, so any binary thus linked pops up an
error message from Windows (cannot find a required DLL) when autoconf
tries to run it. This completely breaks autoconf and is very annoying
Does anyone know a better way to only detect import libraries where the
real library actually exists?
I was thinking that, since import libraries are no longer necessary, and
no import libraries exist for msvcr80.dll, would it be possible to
simply teach MinGW's ld to look in the PATH for matching libraries? Then
the import libs could be removed completely, I would not have this
problem with autoconf, and I would not need to mess about with creating
symlinks in my MinGW libs directory in order to compile things.
What do you think about this proposal?
Thanks again for your help.
___ __ _
/ __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK |
/ (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer |
\ _/_/_/_//_/___/ | We are GNU-free your mind-and your software |