VC++编写的DLL连接库'smspdu.dll'中有函数:
bool OpenComm(const char* pPort, int nBaudRate, int nParity, int nByteSize, int nStopBits);
bool SendShortMessage(const char* send_number,const char* send_msg,SM_PARAM  *sm_param_temp);
int ReceiveMessage(SM_PARAM *sm_param,int index);
bool DeleteMessage(int index);
BOOL gsmGetCenterNumber(char* strCenterNumber);
我想在DELPHI中进行调用,请问,该在程序中如何声明??
function OpenComm(????????):Boolean;stdcall;external 'smspdu.dll'
请问对吗?

解决方案 »

  1.   

    只要你的DLL没有问题  这样调用可以的???????? 是什么意思 
    看这100分上我帮你  function OpenComm(pPort: pchar, nBaudRate: integer, nParity: integer,
      nByteSize: integer, nStopBits: integer,):): Boolean;
      stdcall; external 'smspdu.dll' name 'OpenComm';name 'OpenComm'; 里的名字和你DLL里export 里的名字一样
      

  2.   

    function OpenComm(pPort: pchar, nBaudRate: integer, nParity: integer,
      nByteSize: integer, nStopBits: integer): Boolean;
      stdcall; external 'smspdu.dll' name 'OpenComm';
    呵呵 刚才写多了个,):
      

  3.   

    声明不用加参数了
    function OpenComm:Boolean;stdcall; external 'smspdu.dll' name 'OpenComm' 不过C++里用到的自定义类型要用delphi重新定义一次
      

  4.   

    是呀 同意楼上。。SM_PARAM 这个是C++里面的结构体 你要在调用方这边转成相应的 record...
      

  5.   

    声明可以不加参数的啊,以前都不知道,如果用c写的
    dll 函数原型是  int Test (char *a, char *b)
    a 是指向字符串  b指向 结构体数组如果可能会修改 字符串和 结构体数组里的内容的话 
    比如结构体为   struct node{ int c;  char d; node *i;} listNode;不知道delphi的函数怎么声明哪  谢谢
      

  6.   

    struct node{ int c;  char d; node *i;} listNode;可以对应的为
    PListNode=^PListNode
    ListNode=record 
     c:integer;
     d:char;
     i:PListNode;
    end;
    对不对,糊涂了,哈哈
      

  7.   

    bool OpenComm(const char* pPort, int nBaudRate, int nParity, int nByteSize, int nStopBits);function OpenComm(pPort:pchar;nBaudRate,nParity,nByteSize,nStopBits:integer):boolean;stdcall;far;external 'smspdu.dll';vc里必须用stdcall声明,即:
    bool _stdcall OpenComm(const char* pPort, int nBaudRate, int nParity, int nByteSize, int nStopBits);
      

  8.   

    function OpenComm(pPort:pchar;nBaudRate,nParity,nByteSize,nStopBits:integer):boolean;stdcall;far;external 'smspdu.dll';vc里必须用stdcall声明,即:
    bool _stdcall OpenComm(const char* pPort, int nBaudRate, int nParity, int nByteSize, int nStopBits);