Visual Studio merging DLL into console application
I have ve开发者_开发知识库ry simple program to simplify things as shown below...
#include <openssl/evp.h>
int main (int argc, char *argv[])
{
EVP_CIPHER_CTX ctx;
EVP_CIPHER_CTX_init(&ctx);
}
It references 1 function in a DLL(libeay32.dll from openSSL). I build it with settings "Linker->Input->Additional Dependencies->" pointing to where the libeay32.lib is stored. However when you run it will complain with "This application has failed to start because LIBEAY32.DLL was not found". I want to build it so I can have this DLL built into the executable so it doesn't need to look for it on client machines.
If you can assist can you please explain it in small baby steps so I can understand as I'm a beginner to Visual Studio.
What you're asking is to link statically to your executable.
Here's a guide on how to get OpenSSL to compile to a static library on various platforms.
This isn't exactly what you're asking for, but you could just put the DLL file in the same folder as your compiled binary.
Unfortunately you cant include a dll in a .Net executable at this time using Visual Studio.
Some people have managed to solved this by using Mono instead.
Here are some links discussing it:
- Please Sir May I have a Linker?
- The State of Linkers for .NET apps
The problem is not related to the linker or Visual Studio. The problem is running the application. You must place the library libeay32.dll in a directory that is included in the PATH or in the same directory where the executable.
EDIT: Check Packing an exe + dll into one executable (not .NET)
HTH.
精彩评论