Linking Openssl library(calling convention _cdecl) with a dll(calling convention _stdcall)

  • Thread starter Thread starter Sathish308
  • Start date Start date
S

Sathish308

Guest
Hi,

I am linking openssl library(openssl.lib) to an dll. When I build this dll, I found few linker errors. I debugged and found that linker errors are because of calling convention of dll. My dll is using _stdcall calling convention whereas openssl is using _cdecl calling convention. I can't change the calling convention of my dll since it is part of existing solution. So I tried to change the calling convention of openssl to _stdcall. But I could not do, it ended up in following build errors.

\crypto\ui\ui_openssl.c(591) : error C2440: 'function' : cannot convert from 'void (__stdcall *)(int)' to 'void (__cdecl *)(int)' .\crypto\ui\ui_openssl.c(591) : warning C4024: 'signal' : different types for formal and actual parameter 2 .\crypto\ui\ui_openssl.c(591) : error C2440: '=' : cannot convert from 'void (__cdecl *)(int)' to 'void (__stdcall *)(int)' .\crypto\ui\ui_openssl.c(592) : error C2440: 'function' : cannot convert from 'void (__stdcall *)(int)' to 'void (__cdecl *)(int)'

Lines of code causing the build errors are:

static void pushsig(void)
{
#ifndef OPENSSL_SYS_WIN32
int i;
#endif
#ifdef SIGACTION
struct sigaction sa;

memset(&sa,0,sizeof sa);
sa.sa_handler=recsig;
#endif

#ifdef OPENSSL_SYS_WIN32
savsig[SIGABRT]=signal(SIGABRT,recsig); // **line 591**
savsig[SIGFPE]=signal(SIGFPE,recsig); // **line 592**
savsig[SIGILL]=signal(SIGILL,recsig);
How can I build the openssl library with _stdcall(/Gz) calling convention? Or is there any other solution to this ?

Note : signal is a windows API(calling convention is _cdecl). Please refer this link signal

Thanks,
Sathish.

Continue reading...
 
Back
Top