Jed,
To build static openssl libraries; (libeay32.lib & ssleay32.lib)

    > perl Configure VC-WIN32 no-rc5 no-idea no-mdc2
    > ms\do_nasm
        Edit: ms\nt.mak file (use any standard text editor)
           change '/MD' to '/MT' in CFLAG
    > nmake -f ms\nt.mak

libeay32.lib & ssleay32.lib will be built in directory out32; the necessary
include files will be built inc32\openssl

Just make sure you use /MT switch consistently when building your
application.  If you attempt a 'debug' build of your apllication it will use
/MTd switch and will run into a conflict with library LIBCMT.lib; you can
choose not to do the debug build of your application or you can change /MTd
switch to /MT and define /define _DEBUG to /define NDEBUG

Cheers,
Saju
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Scott Rueter
Sent: Friday, February 01, 2008 12:48 PM
To: openssl-users@openssl.org
Subject: Re: Trying to statically link to libeay32.lib


Jed Mitten wrote:

>I am trying to statically link into libeay32.lib so that I can
>distribute my application as a single executable instead of packaging
>DLLs along with it.  I am not new to programming, but I am new to
>using libraries in C/C++.  I am also completely new to using OpenSSL
>in any application.
>
>I did some extensive research online (and in this group) to get to
>where I could actually compile OpenSSL on Win32 and link using Visual
>C++ Express 9.0, but when I run the application that compiles I get an
>error that libeay32.dll cannot be found.  Thanks for any help or
>advice.
>
>
Option 1:
First, it seems that you have compiled a dll rather than a static lib
for openssl.
IE you used: nmake -f ms\ntdll.mak

If you want a static lib you need to run:
nmake -f ms\nt.dll

When you create a dll build it creates a .dll and .lib.  The lib for
linking against when you make your own executable, but you will still
need to include the .dll in your distribution.
If you create a static build, all you will have is a .lib; no .dll will
be created.

Note however that your executable will be larger if you use a static
library.

Option 2:
The other option is to take your libeay32.dll and put it in the same
directory as your executable.

>#include <iostream>
>#include <string>
>#include <openssl/blowfish.h>
>using namespace std;
>
>
>int main(int argc, char *argv[]) {
>    string skey = "secret_key";
>    char *sdata = "This is a message that I would like to keep secret.
> Please do not allow this message to be read without authorization.";
>
>    BF_KEY symKey;
>    BF_set_key( &symKey, strlen(sdata), (const unsigned char *)sdata );
>
>    cout << symKey.S;
>
>    return 0;
>}
>
>--
>Jed Mitten
>______________________________________________________________________
>OpenSSL Project                                 http://www.openssl.org
>User Support Mailing List                    openssl-users@openssl.org
>Automated List Manager                           [EMAIL PROTECTED]
>
>
>
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to