On Thu, Jun 20, 2013 at 2:31 PM, zhangxinghai <zxh19750...@163.com> wrote: > Hello > I write a test helloworld program.I want to link it against msvcr100.My > enviroment is > os:xp sp3 > mingw64 version:ruben build target win32 > I compile the program as > gcc -o hello.exe main.cpp -lmsvcr100. > > My problem is when I add -lmsvcr100 switch,I run the dependency walker on > the hello.exe,I see it depends on both msvcrt.dll(c:\windows\system32) and > msvcr100.dll. > But If I write the same program under vs 2010,the output hello.exe only > depends on msvcr100.dll > > Is is possible for mingw64 to generate executable file only depend on > msvcr100.dll? Or do I do something wrong ? >
Yes. If you see the verbose output: crt2.o crtbegin.o cc1woImu.o -lmsvcr100 -lstdc++ -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt crtend.o You can see '-lmsvcrt' in the library list. So you can do this: g++ -dumpspecs > msvcr100.spec Edit msvcr100.spec, change '-lmsvcrt' to '-lmsvcr100', then just execute: g++ -specs=msvcr100.spec -s -O2 -o hello.cpp.exe hello.cpp Then 'hello.cpp.exe' only depend on 'msvcr100.dll'. But 'hello.cpp.exe' depend on 'libstdc++-6.dll', you must compile your self to avoid 'libstdc++-6.dll' depend on 'msvcrt.dll' too. ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public