Pelles C forum

Pelles C => General discussions => Topic started by: bik on November 04, 2014, 02:29:19 PM

Title: Compiling and linking with openssl library libcrypto.a
Post by: bik on November 04, 2014, 02:29:19 PM
Hello,

if compiling with __cdecl and linking with libcrypto.a I get linker error messages:

POLINK: error: Unresolved external symbol '__errno'.
POLINK: error: Unresolved external symbol '__imp___iob'.
POLINK: error: Unresolved external symbol '___umoddi3'.
POLINK: error: Unresolved external symbol '___udivdi3'.
POLINK: error: Unresolved external symbol '__imp____mb_cur_max'.
POLINK: error: Unresolved external symbol '__imp___pctype'.
POLINK: error: Unresolved external symbol '__isctype'.

This symbols are listed in PODUMP of the library as

... UNDEF  notype      external ...

in several *.c sources.
Compiling and linking the same sources in DevCpp IDE, all references are solved.

Therefor my question: What's the matter? Are there some PellesC-Libraries to solve that problem?

Thanks for answer.   

BiK
Title: Re: Compiling and linking with openssl library libcrypto.a
Post by: TimoVJL on November 04, 2014, 03:31:02 PM
That libcrypto.a is linked against msvcrt.lib or mingw static library ?

Title: Re: Compiling and linking with openssl library libcrypto.a
Post by: frankie on November 04, 2014, 05:12:23 PM
If it works in DevCpp it should be linked against MingW I suppose ...  :(
Title: Re: Compiling and linking with openssl library libcrypto.a
Post by: TimoVJL on November 05, 2014, 09:18:09 AM
Isn't libeay32.lib/ssleay32.lib enough for openssl from here (https://code.google.com/p/openssl-for-windows/) ?

EDIT: 32-bit msvcrt.def/msvcrt.lib for testing static linking with libcrypto.a.
Title: Re: Compiling and linking with openssl library libcrypto.a
Post by: bik on November 06, 2014, 01:03:38 PM
Thank you for answer.

Compiling with difmod.c is ok, but linking now with libcrypto.a and msvcrt.lib conflicts. One only error message:
POLINK: error: Symbol '_fclose' is multiply defined: 'msvcrt.lib(msvcrt.dll)' and 'crt.lib(fclose.obj)'.

Linking with libeya32.lib resolves all externals. But for run it is nessesary also to include libeay32.dll in windows directory.
To avoid to place libeay32.dll in windows or working directory of the exe, I converted libeay32.dll with the import library libeay32.lib to the static library libeay32dll.lib (by means of DLL to LIB 3.0, http://www.binary-soft.com/).
With the linker parameters

-subsystem:windows -machine:x86 -map -release kernel32.lib user32.lib gdi32.lib advapi32.lib wsock32.lib libeay32dll.lib

the exe was built successful.