function VsppCommInit(nPort:Dword;key:Dword):Dword;stdcall;external 'D:\delphi\IVR_gateway\SpServer.dll';编译的时候,系统提示"开法定位程序输入点VsppCommInit于动态链接库D:\delphi\IVR_gateway\spserver.dll上"
动态链接库是有这个函数的。并且路径也是正确的。
不知到底哪错了。。望大侠们指点迷津

解决方案 »

  1.   

    //定义
    Const
      DllName='SpServer.dll'
    function VsppCommInit(nPort:Dword;key:Dword):Dword;stdcall;
    //实现
    implementation
    function VsppCommInit;external DLLName name 'VsppCommInit';1、检查函数名,确保函数声明和原型一致(大小写?)
    2、检查函数参数。
    3、载入的动态链接库不要用绝对地址。只需要声明dll名,程序会自动在当前目录、系统变量path列出的目录中寻找。建议:看看windows中的函数声明,再和windowsSDK的文档对比,大概就明白了。
      

  2.   

    to lianshaohua
     开始我也这样认为,我用viewdll.exe 程序查看.
     与里面的函数名是相同的.
      

  3.   

    函数的原型 Unsigned int WinApi export VsppCommInit(Unsigned int nPort,Unsigned in key);
      

  4.   

    不知道你的问题在哪里,反正你的声明看起来有点别扭。
    我今天用C++按照你的函数原型写了个DLL,在Delphi中按照我的调用方式没有任何问题啊。
      

  5.   

    函數輸出定義, 沒用 extern 'C' 方式
      

  6.   

    to exu(大脸猫)
     老大,你delphi 怎么写的.
      

  7.   


     Email:[email protected]
     谢谢 exu
      

  8.   

    我刚又重新试了一下。这次又有新的错误,北极寒呐.  function VsppCommInit_S(nPort:DWord;key:Dword):DWord;stdcall;external 'SpServer.dll' name 'VSPPCommInit';procedure TForm1.Button1Click(Sender: TObject);
    var
     Comminit_sta1:LongWord;
    begin
     Comminit_sta1:=VsppCommInit_S(8887,1);
    // showmessage(inttostr(Comminit_sta1));
    end;一运行就出说地址访问错误.
    "Access violation at address 00CD62AF Write of address 00000000"
      

  9.   

    c中声明为Unsigned int WinApi 在delphi中
    function VsppCommInit_S(nPort:DWord;key:Dword):DWord;stdcall;external 'SpServer.dll' name 'VSPPCommInit';stdcall;
      

  10.   

    载入的动态链接库不要用绝对地址。只需要声明dll名,程序会自动在当前目录、系统变量path列出的目录中寻找。同意。
      

  11.   

    函数的原型 Unsigned int WinApi export VsppCommInit(Unsigned int nPort,Unsigned in key);
      

  12.   

    函数的原型 Unsigned int WinApi export VSPPCommInit(Unsigned int nPort,Unsigned in key);
      

  13.   

    一运行就出说地址访问错误.
    "Access violation at address 00CD62AF Write of address 00000000"
      

  14.   

    兄弟,原来是大小写的问题呀。使用DLL函数的地方需要声明的函数的大小写要同DLL中EXPORTS的函数名。