From: David F. <da...@sj...> - 2003-02-19 10:32:57
|
Hi Earnie recently helped me link my application with msvcrtd instead of msvcrt. The final point reached was to add a -mmsvcrtd switch to the specs file which then links with msvcrtd instead of msvcrt. Then, with a very simple C program, the files link only to msvcrtd, not msvcrt. However, if open() or write() is referenced, the executables still contain a link to msvcrt as well as msvcrtd. This didn't seem to be a problem, but now it does... Basically in our wxWindows app, when linking with msvcrtd, we get errors trying to write to a file. These are reproducible in a very simple wxWindows program, linking in the wx library statically. (They strangely do not occur when trying to do the same thing using standard file functions). I suspect that the problem is that open(), write() are defined in libmoldname, which links to msvcrt by default. This suspicion is confirmed by the fact that using _open, _write doesn't link in msvcrt at all. The solution to me seems to be to build a libmoldnamed.a which links to msvcrtd instead of msvcrt. Is this correct, and how should I go about doing it? Thanks David >> Also, how can I link my app with this and not the standard >> libmsvcrt.a (without having to use ld >> myself - I can link a simple app using ld to specify libmsvcrtd.a.)? >> If I just add a -lmsvcrtd to the gcc command it links in both msvcrt >> and msvcrtd (and seems to have problems: it exists without an error >> in a simple program after the >> first printf...). >> > > That'll require a little work on the specs file for GCC that'll > recognize a switch (say -mmsvcrtd) that will use the debug runtime > version. > > Something like: > *libgcc: > %{mthreads:-lmingwthrd} -lmingw32 -lgcc -lmoldname -lmingwex > %{mmsvcrtd:-lmsvcrtd} %{!mmsvcrtd:-lmsvcrt} > > Watch the line wrap, two lines worth of specs file. > > Earnie. |