calling the OPENSSL libs in windows mobile

1.    Steps to new a application
    a)    New a smart device project
    b)    Add additional include directory: ../celib; ../celib/openssl; ../celib/include;    The last path is where the wcecompat h file stored.
    c)    Add additional dependencies: ../celib/ssleay32.lib ../celib/libeay32.lib
    d)    Copy the libeay32.dll, libeay32.lib, ssleay32.lib and ssleay32.dll into working directory.
    e)    Include any .h file needed from OPEN SSL
    f)    Just call the functions in OPEN.
    g)    According to your CE SDK, choose debugger to launch.

2.    error shooting
a)    link error:
    i.    xxx already defined in LIBCMTD.lib.
        ignore the lib, by opening the property page, add the lib into Linker—Input—Ignore Specific Library.
    ii.    abs is not defined.
        Abs comes out... more exercises are needed.
        Add head file: #include <math.h>

b)    deploy error, not enough disk space
    well, we can debug the exe in the Storage card. Just change the two setting:
    Debugging—Remote Executable: 存储卡/...
    Deployment—Remote Directory:  存储卡/...
    The path maybe different, check your cell phone.

c)    deploy OK, when run the exe error with code 0x8007007e: don’t have certain needed DLL with in the directory.
If it’s a MFC application, those DLL is needed:
    MFC80UD.dll
    atl80.dll
    msvcr80.dll
    msvcr80d.dll
    libeay32.dll
    ssleay32.dll
    Make sure all the Dll file is in the same directory of the exe file.

d)    Use static OPEN lib in win application.
    All the process abobve we use the DLL edition, if you are using the static lib of OPEN, you will also need to include libs: ../celib/wcecompat.lib  ../celib/wcecompatex.lib
    But the lib wcecompat doesn’t support win application to call the static OPEN lib yet, we may confront the compiling error message: “Error    1    error LNK2019: unresolved external symbol main referenced in function WinMain    wcecompat.lib”
    if we still need to link the static lib, we need to rebuild the wcecompat.lib.
        open the file “makefile” and delete the line 20: “src/winmain.cpp                /”.
        rebuild.
    With the new lib we can call the static OPEN lib in win application.

e)    What I understand of these errors is that linker could not find definitions of following variables/functions in the library:
    1. _abort
    2. __iob
    3. __pctype
    4. __errno
    5. ___mb_cur_max
    6. __isctype
    7. __aulldiv
    8. __aullrem
    9. __allmul
    This matters because other lib links against openssl.
    the generated makefiles for Win32 hard code /MD into the compiler flags. This causes the link with your program to want the DLL runtime. (Note your error messages that mention dllimport.)You may edit ms/nt.mak after you run the configure. Find the line that begins with: CFLAG= /MD Change the /MD to something better, like /MT (multithreaded using LIBCMT.lib) or /ML (single threaded using LIBC.lib). Whatever you choose here must be the same as what you use for your program that links against this library.
    Now run the make and the install and try linking to your program.

你可能感兴趣的:(windows,File,application,dll,include,dependencies)