I'm working on a C++ application for Windows that uses OpenSSL 1.0.1e library. I'm on Visual Studio 2008.
For portability reasons my application is statically linked against runtime libraries (/MT
and /MTd
options). And I don't ship runtime libs with my application.
Per the OpenSSL FAQ, the library is by default linked against multithreaded DLL runtime (/MDd
) which is obviously incompatible with my scenario. So to make my program work I've added applink.c
to my project. On my dev machine and on most test computers the program works fine.
But unfortunately I've located computers where the app doesn't start. Windows displays error:
The application failed to initialize properly (0xc0150002). Click on OK to
terminate the application.
I've opened libeay32.dll
in Dependency Walker and I see that MSVCR90.dll
is not found. So the trick with applink.c
doesn't really work for me.
How do I build OpenSSL with /MT
or /MTd
option?
Use the nt.mak
makefile rather than the ntdll.mak
makefile.
As an aside, I have written some scripts around the standard OpenSSL build scripts which make it 'easier' (for me at least) to use OpenSSL on Windows with a mix of both x86 and x64, you can get them from here.