我现在用delphi做一个地理信息系统(mapgis)的二次开发
mapgis的开发方法有几种,其中一种是基于api函数,它的开发手册上说:mapgis二次开发api函数的实现被封装于若干动态链接库文件(dll)中,……,无论你使用vc++还是delphi,你在这些工具中如何调用windows的api函数,你就怎么调用这些二次开发函数,
那我现在想在delphi下调用它的api函数要怎么调用?mapgis的dll是用vc写的,我用import type library,它说加载类型库\dll出错

解决方案 »

  1.   

    Windows单元有很多调用dll的例子,可以看看—————————————————————————————————
    宠辱不惊,看庭前花开花落,去留无意;毁誉由人,望天上云卷云舒,聚散任风。
    —————————————————————————————————
      

  2.   

    1 参数类型最好与window C++的参数类型一致。不要用DELPHI的数据类型。2 最好有返回值[即使是一个过程],来报出调用成功或失败,或状态。成功或失败的返回值最好为1[成功]或0[失败].一句话,与windows c++兼容。3 用stdcall声明后缀。4 最好大小写敏感。5 无须用far调用后缀,那只是为了与windows 16位程序兼容。
      

  3.   

    1 客户端函数声名:1)大小写敏感。2)与DLL中的声明一样。如: showform(form:Tform);Far;external'yproject_dll.dll';3)调用时传过去的参数类型最好也与windows c++一样。4)调用时DLL必须在windows搜索路径中,顺序是:当前目录;Path路径;windows;widows;windows;
      

  4.   

    刚写的用于检测字符串是否合法的DLL使用示例:unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        Button1: TButton;
        Edit1: TEdit;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;  function CheckIP(const mIP: PChar): BOOL;        // DLL函数声明;
       
    implementation{$R *.dfm}  function CheckIP; external 'IPCheck.DLL' name 'CheckIP';  // DLL函数实现
      
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      if CheckIP(PChar(Edit1.Text)) then ShowMessage('OK!')    // DLL函数调用
      else ShowMessage('IP Error!');
    end;end.
      

  5.   

    可是我一调用mapgis的dll就会出现无法定位程序输入点_GetSySVersion于动态链接库w60area.dll上,大小写我注意了