I want to use DLL compiled with Cygwin with VC(VS2008).
Y.Hosoi
mlist@mail.cuvie.net
Mon Feb 14 04:03:00 GMT 2011
Thank you.
However, it did not move well.
If test.dll is done in LoadLibrary, Access Violation is generated.
Are you still amused something?
[main source code]
#include "stdafx.h"
#include "windows.h"
#ifdef __cplusplus
extern "C"{
#endif
typedef int (*TFUNC)(void);
typedef void (*Tinit)(void);
int _tmain(int argc, _TCHAR* argv[])
{
int i;
HINSTANCE h;
HINSTANCE hInstDLL;
Tinit init;
TFUNC DllFunction;
DWORD ErrNo;
h = LoadLibrary( TEXT( "cygwin1.dll" ) );
init = (Tinit)GetProcAddress( h, "cygwin_dll_init" );
init();
hInstDLL = LoadLibrary( TEXT( "test.dll" ) ); /* !Access Violation! */
if( hInstDLL == NULL )
{
ErrNo = GetLastError();
return 0;
}
DllFunction = (TFUNC)GetProcAddress( hInstDLL, "hello" );
i = DllFunction();
FreeLibrary( hInstDLL );
FreeLibrary( h );
return 0;
}
#ifdef __cplusplus
}
#endif
--
Y.Hosoi <mlist@mail.cuvie.net>
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list