I am trying to build a DLL and it needs to reference a library namely libeay32.dll from the openssl package. I cant seem to add it as a reference under the Property Pages->Common Properties->Add New Reference because it gives error "Could not add a reference to file 'C:\OpenSSL\libeay32.dll' because it is neither a .NET assembly or registered Active X Control. I can compile and run it when I use the Linker->Input->Additional Dependencies and set the static lib 'C:\OpenSSL\lib\libeay32.lib'. But the end result is I need to include the libeay32.dll also. What am I doing wrong?
You're doing everything correctly. "Add Reference" is for .NET assemblies (and COM components used via .NET COM interop). The second approach that you've tried is the correct way to do this for native code, but libeay32.lib
is not a static library; it's an export library for the DLL.
From openssl-0.9.8l.tar.gz\INSTALL.W32 "...You can also build a static version of the library using the Makefile ms\nt.mak ..."
This probably means that developers of SSL want you to follow their adoption routine i.e.
- rebuild thing from source using whatever obscure Win32 platform dependencies were out there 7-10 years ago
- for this: use nmake and masm
- for this: install non the less Windows DDK! (as they require masm)
- set couple of million build flags to target make to produce static portion of library
- before you run make, you will need to have:
- perl!
- but wait, to run perl you probably will need Cygwin
Welcome to open source world. I'd rather never use open source alltogether
As Pavel metioned, libeay32.lib is not the full library that your application can be statically linked against and run. It's used to resolve reference to the dynamic lib, dll. So, your app still need the dll to run.