3

I'm using Windows 7 and the latest MinGW version (gcc v4.7.2).

My problem is, to trigger MinGW to use the "MSVCR100" and the "MSVCP100" runtime dll's for a simple test application.

My default customized spec file looks like as follows:

%{mthreads:-lmingwthrd} -lmingw32 %{shared-libgcc:-lgcc_s} %{!shared-libgcc:-lgcc_eh} -lgcc -lmoldname -lmingwex -lmsvcr100 -lmsvcp100

(The mingw distribution doesn't ship any "MSVCP100.a" in the lib directory, so I've just created with the help of "dumpbin" and "dlltool" my the "MSVCP100.a" file.)

My problem is now, in case I compile my simple test application (which uses boost-date-time and boost-log), I get the following undefined references:

  • undefined reference to `gmtime'
  • undefined reference to `localtime'

But this shouldn't be possible, as in case I compile my test application with Visual Studio 2010 and analyse aftewards the binary with a dependency walker, I see, that the dll's "MSVCR100" and "MSVCP100" are referrenced.

Why do I need this? I've figured out, that my test application crashes on a Windows XP- but not on Win7 systems, as the "setlocale" function within the "msvcrt.dll" (v7.0.2600.5512) isn't thread-safe (please check the conversation between me and the boost.log maintainer regarding this issue here:
Boost-Log). So I was curios, if my test application will also crash, in case I compile it with Visual Studio 2010 and test the binary on WinXP. I figured out, that no crash happens, as Vistual Studio links my test application against "MSVCR100.dll" (and MSVCP100.dll).

Due to some restriction, it isn't possible to migrate my project code from MinGW to Visual Studio. So I tried to change the specs file of mingw to link against the mentioned dll's.

Question: How can MinGW be triggered, to not anymore link against "msvcrt.dll", but rather to the "msvcrt100.dll"? Or more generally: How to trigger MinGW to use the same runtime dll's as Visual Studio does?

Any help is appreciated. Thanks so far,

Rafael

Regina Balusz
  • 91
  • 2
  • 11

1 Answers1

0

Try it with:

%{mthreads:-lmingwthrd} -lmingw32 %{shared-libgcc:-lgcc_s} %{!shared-libgcc:-lgcc_eh} -lgcc -lmoldname100 -lmingwex -lmsvcr100 -lmsvcp100

Amit Naidu
  • 2,494
  • 2
  • 24
  • 32