<선언>
#ifndef MDBDLL_H
#define MDBDLL_H
#ifdef MDBDLL_EXPORTS
#ifdef __cplusplus
#define MDBDLL_API extern "C" __declspec(dllexport)
#else
#define MDBDLL_API extern __declspec(dllexport)
#endif
#else
#ifdef __cplusplus
#define MDBDLL_API extern "C" __declspec(dllimport)
#else
#define MDBDLL_API extern __declspec(dllimport)
#endif
#endif
MDBDLL_API HANDLE CALLBACK MDB_OpenComPort(char far *c, int polltime, HWND hWnd);
<호출>
CString comStr;
comStr=((CMdbdemoApp*)AfxGetApp())->m_comString;
m_hCom=MDB_OpenComPort(comStr.GetBuffer(comStr.GetLength()),100,m_hWnd);
변수 내용m_comString="COM1"
var
Form1: TForm1;
m_hCo:LongWord;
m_Hwnd:LongWord;
implementation
function MDB_OpenComPort(c:PChar;polltime:integer; hWnd:LongWord):LongWord; stdcall;external 'mdbdll.dll';
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
m_hCo:=MDB_OpenComPort('COM1',100, m_hWnd);
end;
호출을 하면 손실된 엑스포드 MDB.DLL .... 하고 메시지가 나오네요
도무지 모르겠네요
고수님들의 방법을 알려주십시요 꼭 이요
그렇담 호출규약을 함 살펴보시는게...
델파이측 선언부분에서요...
stdcall을 cdecl로 함 바꿔보세요.
즐거운 코딩 되시길...
박춘홍 wrote:
>
> <선언>
> #ifndef MDBDLL_H
> #define MDBDLL_H
>
> #ifdef MDBDLL_EXPORTS
> #ifdef __cplusplus
> #define MDBDLL_API extern "C" __declspec(dllexport)
> #else
> #define MDBDLL_API extern __declspec(dllexport)
> #endif
> #else
> #ifdef __cplusplus
> #define MDBDLL_API extern "C" __declspec(dllimport)
> #else
> #define MDBDLL_API extern __declspec(dllimport)
> #endif
> #endif
>
> MDBDLL_API HANDLE CALLBACK MDB_OpenComPort(char far *c, int polltime, HWND hWnd);
> <호출>
> CString comStr;
> comStr=((CMdbdemoApp*)AfxGetApp())->m_comString;
> m_hCom=MDB_OpenComPort(comStr.GetBuffer(comStr.GetLength()),100,m_hWnd);
>
> 변수 내용m_comString="COM1"
>
>
> var
> Form1: TForm1;
> m_hCo:LongWord;
> m_Hwnd:LongWord;
>
> implementation
>
> function MDB_OpenComPort(c:PChar;polltime:integer; hWnd:LongWord):LongWord; stdcall;external 'mdbdll.dll';
> {$R *.DFM}
>
> procedure TForm1.Button1Click(Sender: TObject);
> begin
> m_hCo:=MDB_OpenComPort('COM1',100, m_hWnd);
> end;
>
> 호출을 하면 손실된 엑스포드 MDB.DLL .... 하고 메시지가 나오네요
> 도무지 모르겠네요
> 고수님들의 방법을 알려주십시요 꼭 이요