|
안녕하세요.
저는 지금 VC/VB에서 처리하는 DLL을 BCB로 만들고 있는데요.
초장부터 막히는군요.
다름이 아니라 DLL의 전달 변수를 처리하고 나면 DLL 함수 리턴 부분에서 에러가 나는데, calling convention이 안맞다고 나오거든요.
예를 들면 VC쪽에서 다음과 같이 exe파일을 만들고.
typedef int ( *TEST )( void );
typedef void ( *STRINGTEST )( CString );
dll = ::LoadLibrary( "D:\\pci4gx100.dll" );
DWORD error = ::GetLastError();
TEST test;
STRINGTEST stringtest;
TCHAR t[ 12 ] ;
test = ( TEST )::GetProcAddress( dll, "test" );
stringtest = ( STRINGTEST )::GetProcAddress( dll, "stringtest" );
int j;
j = test();
t = "MFCCString" ;
MessageBox( t );
stringtest( t );
MessageBox( t );
::FreeLibrary( dll );
BCB의 stringtest를 보면
DLLEXPORT void _stdcall stringtest( CString t )
{
int length, i;
length = t.GetLength();
for ( i = 0 ; i < 4 ; i++ )
tempstr[ i ] = t.GetAt( i );
tempstr[ i ] = '\0';
return;
}
이와 같이 처리해주는데
tempstr[ i ] = '\0';이후에 에러가 뜨고 ( debugger mode ) release mode에서는 프로그램이 그냥 종료해 버립니다.
그럼 고수님들의 많은 조언 부탁드릴께요.
|