How Can I use .net dll in C program?

MSVCRT.dll versus MSVCRT40.dll

  • I use the C Runtime library as a DLL as the size of my programs are very important. Typically this is done by linking with msvcrt.lib which is an import library for msvcrt.dll. This will require that msvcrt.dll be present on the computer loading your program. However, the default installation of Windows 95 does not install msvcrt.dll - it does install msvcrt40.dll which appears to be for the most part functionally equivilent. On Windows 95 msvcrt40.dll contains the C runtime functionality, and on other versions of windows (98+), msvcrt40.dll is a forwarding DLL to msvcrt.dll. So, it would appear that in order to make a program load properly on every version of windows, one would want to link with msvcrt40.dll. I'm using Visual Studio 6.0 and it does not contail an import library for msvcrt40.dll (i.e. msvcrt40.lib). Searching the web I was unable to find this file either, but there appear to be a number of programs that use msvcrt40.dll so it must exsist somewhere. My question is, where can I find msvcrt40.lib or is there any other way for my to link against msvcrt40.dll instead of msvcrt.dll. This seems to indicate that msvcrt40.lib is included with Visual Studio 4.0, where can I get a copy of Visual Studio 4.0? Or perhaps someone reading this has a copy of the library in question. http://support.microsoft.com/default.aspx?scid=kb;EN-US;q154591 I'm not interested in other solutions such as installing a copy msvcrt.dll with my program or linking statically with msvcrt.

  • Answer:

    Dear jonathanclark: Thank you for your question. From what I have found, there is no import library file named msvcrt40.lib. From a newsgroup posting by a MSFT employee: "The import library for the CRT dll has always been named msvcrt.lib and msvcrtd.lib, even when the DLL was called msvcrt40.dll. Its just been convention and prevents you from having to change makefiles around from version to version..." http://www.dotnet247.com/247reference/msgs/1/7824.aspx A MSDN article also supports this fact: "The MSVCRT.LIB library, which calls code in the shared MSVCRT40.DLL, is also reentrant." http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_core_library_support_for_multithreading.asp I hope this answers your question! If you need any clarifications, please don't hesitate to ask. I would be more than happy to assist you further. Best Regards, blader-ga

jonathanclark-ga at Google Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.