How do I create a Win32 DLL without a dependency o

2019-02-09 10:39发布

Using Visual Studio 2008 and its C/C++ compiler, how do I create a Win32 DLL that is dependent only on other Windows DLLs, and has no dependency on the Microsoft C runtime?

I have some C code I want to place in a DLL that is entirely computation, and makes almost no use of C library functions.

For those it does use (eg memcpy), I'm happy to rework the code to use the Win32 API equivalents (eg CopyMemory).

标签: c++ c winapi dll
7条回答
▲ chillily
2楼-- · 2019-02-09 11:29

Use the /NODEFAULTLIB linker option and (of course) make sure you have no actual dependencies on the runtime. You'll also have to specify & define your own entry point for the DLL using the /ENTRY linker option or alternatively have your own entry point function that matches the name expected by the compiler/linker (for a dll, that's _DllMainCRTStartup).

Matt Pietrek's article from way back when on LIBCTINY will probably have all the information you need:

查看更多
登录 后发表回答