문제

I compiled the following code into a DLL in visual C++ with the "release" configuration

#define MY_FIRST_DLL __declspec(dllexport)

extern "C" MY_FIRST_DLL
int main(void)
{
   return 0;
}

And the size of the DLL was 7 KB.

I created a file called test.cpp and compiled it manually in command-line with the following:

cl /LD test.cpp

And it was 32 KB.

What does the IDE do that allows it to create the 7 KB dll from the same code? And how can I achieve the same result manually (or perhaps a batch file)?

도움이 되었습니까?

해결책

When you set the 'release' option, the command line to build your code is very different. Visual Studio sets the optimizations settings and other thinks. You can see that command line, in the project configurations: -> C/C++ compiler ( or something like this ) -> command line ( option )

see the picture: enter image description here

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top