views:

178

answers:

4

OK I'm getting desperate here so please I really need some help if anyone could be so kind. It must be a really simple thing but I am absolutely confused still how to fix this problem. I have very 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 doesnt 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.

A: 

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:

Nifle
-1. No .NET related and not linker related. Just missing DLL when running app.
jrbjazz
But he asked if he could **include it into the exe**. And that's the question I answered.
Nifle
A: 

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.

Cory Petosky
A: 

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 http://stackoverflow.com/questions/336961/packing-an-exe-dll-into-one-executable-not-net

HTH.

jrbjazz
Quote from question above. "I want to build it so I can have this **DLL built into the executable** so it doesnt need to look for it on client machines.
Nifle
+1  A: 

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.

Kilanash