3

I'm developing a small tool on Windows 8 which links agains msvcrt.dll and uses memmove_s. I want to deploy my tool on Windows XP machines. My version of msvcrt is 7.0.30xx but on XP its 7.0.2600. The older version does not include memmove_s so program crashes on startup.

I tried installing Microsoft Visual C++ Redistributable Package (both 2010 and 2012) but seems msvcrt.dll is untouched.

sorush-r
  • 10,490
  • 17
  • 89
  • 173
  • Is your application compiled with /MT? http://stackoverflow.com/questions/757418/should-i-compile-with-md-or-mt – Matt Apr 09 '14 at 16:20
  • @Matt I'm using MinGW. I have no idea how libgcc is compiled. – sorush-r Apr 09 '14 at 16:23
  • This problem usually happens when the application links the static runtimes, I think you should check your compiler options. – Matt Apr 09 '14 at 16:25
  • @Matt I've statically linked against `libcrypto++` because it seems impossible to generate dll's of that library. But I don't know how this could be related to MSVCRT... – sorush-r Apr 09 '14 at 16:32
  • 2
    This is a MinGW liability, it can't properly version the CRT since it takes a dependency on whatever the OS provides. If XP support is a hard requirement then you will have to give up on using the secure CRT functions. – Hans Passant Apr 09 '14 at 16:47
  • @HansPassant Even deploying MSVCRT.DLL within project does not help. Any idea? (Do I need to recompile MinGW suite?) – sorush-r Apr 09 '14 at 17:16
  • It is an open source project. Desperately in need of *somebody* that is going to really solve this problem, like a CRT implementation that's compatible with Windows but does not depend on the Microsoft version. That somebody should probably be you. If that's not your cup of tea then you probably should not use open source. – Hans Passant Apr 09 '14 at 17:25
  • I think it's not MinGW's fault :) I checked all DLL s of MinGW, neither of them imports `memmove_s`. And then I find in `memmove_s` in Crypto++ library. Generally linking against msvcrt.dll should be considered a bad practice... – sorush-r Apr 09 '14 at 17:50

1 Answers1

2

msvcrt.dll is a private system DLL owned by Windows. You should neither touch it, nor linking against it.

You should use the ordinary msvcrXXX.dll (e.g. msvcr100.dll if you build with Visual Studio 2010) that ships with Visual Studio (or just use static-linking with CRT, if you don't want to deploy the CRT DLL separately from your tool).

Consider also this note from MSDN CRT documentation:

What is the difference between msvcrt.dll and msvcr110.dll?

The msvcrt.dll is now a "known DLL," meaning that it is a system component owned and built by Windows. It is intended for future use only by system-level components.

Mr.C64
  • 41,637
  • 14
  • 86
  • 162
  • 2
    Some of dependencies (Qt and OpenSSL I think) also link against msvcrt . Is there something like system update or service pack to upgrade MSVCRT.dll of operating system? – sorush-r Apr 09 '14 at 16:20