VC下的变量和delphi下的是怎么对应的呀?
由于有一些硬件卡上提供的API是C写的,现在有一个这些函数原型的C语音的头文件
现在我们在Delphi下需要使用这些函数,需在delphi下重新定义,不知这些类型是怎么对照的
32为的平台C delphilong ?
int Integer
char char
bool boolean
char * ?
? String
? Pchar
word ?
DWord ?还有, API中有一个需要用到函数指针,即使用回调函数C下是这么用的int  WINAPI DJH323_SetCallEventHandler( DWORD dwEventMask, long (WINAPI * hdlr)(DWORD dwEvent, int iChID));
long WINAPI IPCallBackProc(DWORD dwEvent, int ch)
{
......
}
调用时: DJH323_SetCallEventHandler(H323_EV_ALL, IPCallBackProc);我在delphi下这么定义:
type TIPCallBackProc= function(dwEvent: DWORD; iChID: Integer ):Integer;stdcall ;
function DJH323_SetCallEventHandler( dwEventMask: DWORD; IPCallBackProc: TIPCallBackProc):Integer; stdcall; far external 'djH323.dll';
函数实体 
function IPCallBackProc( dwEvent: DWORD; IPch:Integer ):Integer;stdcall ;
begin
end;
调用时: DJH323_SetCallEventHandler(H323_EV_ALL, @IPCallBackProc);可不知道为什么总是出错,好象是堆栈不一致,提示信息:
Debug Error!
Program : D:\....\project1.exe
Module:
file: i386\chkesp.c
line: 42The value of esp was not properly save across a function call. this is usually of calling a function declared with one calling convention with a function pointer declared with a different calling convention.这里C语音下的 long (WINAPI * hdlr) 在delphi下怎么处理呀?
小弟在此先谢过了
//bow

解决方案 »

  1.   


    C delphilong ?Longint
    int Integer
    char char
    bool boolean
    char * ?PChar
    ?<NULL> String
    ?char * Pchar
    word ?Word
    DWord ?DWORD
    这是你昨天贴的帖子,我已经测试过你的代码,在我的机器上没出现什么异常~~
    确定是否还有初始化没完成~~
      

  2.   

    C delphilong Longword
    char * PChar
    No String
    Char *  Pchar
    word Word
    DWord Longword 第二个问题不太明白
      

  3.   

    type TIPCallBackProc= function(dwEvent: DWORD; iChID: Integer ):Integer;stdcall ;应该是:
    type TIPCallBackProc= function(dwEvent: DWORD; iChID: Integer ):LongInt;stdcall ;
      

  4.   

    谢谢各位,问题解决了
    在我的机器上:
    首先要 type  TIPCallBackProc=  function(dwEvent:  DWORD;  iChID:  Integer  ): LongInt; stdcall  ;  
    第二  function     DJH323_SetCallEventHandler(  dwEventMask:  DWORD;  IPCallBackProc:  TIPCallBackProc):Integer;  cdecl;  far  external  'djH323.dll';