How do I create a Win32 DLL without a dependency on the C runtime

前端 未结 7 1527
天涯浪人
天涯浪人 2020-12-31 15:07

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?<

7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-31 15:37

    You may have more dependencies on the CRT than you think. It tears down resources like thread local storage, and global class initializers are run by the CRT before main().

    Consider linking with a static CRT, as someone said, and if you really really don't want to, use /NODEFAULTLIB and /ENTRY as someone else said.

    Oh, and instead of reworking memcpy, consider using the super-fast compiler intrinsic for it. You can turn on intrinsics with /Oi.

提交回复
热议问题