如题:

解决方案 »

  1.   

    var
      {声明一个句柄}
      handle1: Thandle;
      {声明一个将要使用的函数,调用参数及返回值要正确说明}
      myAdd:function(a1: Integer; a2: Integer): Integer;stdcall;begin
       {装入链接库}
       handle1:=loadlibrary('{要调用的函数所在的动态链接库}');
       {判断是否装入成功}
       if handle1<HINSTANCE_ERROR then
        begin
          Application.MessageBox('装入动态链接库失败','错误');
        end
       else
        begin
          Application.MessageBox('装入动态链接库成功','信息');
          {取入口}
          @myAdd :=GetProcAddress(handle1,'myAdd');
          if not (@myAdd=nil) then
            {ok,你可以调用它了……}
            begin
            Application.MessageBox('取入口地址成功','信息');
    {……调用……}
            end
          else
            Application.MessageBox('取入口地址失败','错误');
          {不用了,记得释放}
          freelibrary(handle1);    end;
    end;
      

  2.   

    修正:
    var
      {声明一个句柄}
      handle1: Thandle;
      {声明一个将要使用的函数,调用参数及返回值要正确说明}
      myAdd:function(a1: Integer; a2: Integer): Integer;stdcall;begin
       {装入链接库}
       handle1:=loadlibrary('{要调用的函数所在的动态链接库}');
       {判断是否装入成功}
       if handle1<HINSTANCE_ERROR then
        begin
          Application.MessageBox('装入动态链接库失败','错误');
        end
       else
        begin
          Application.MessageBox('装入动态链接库成功','信息');
          {取入口}
          @myAdd :=GetProcAddress(handle1,'{此处是要取入口地址的函数名}');
          if not (@myAdd=nil) then
            {ok,你可以调用它了……}
            begin
            Application.MessageBox('取入口地址成功','信息');
    {……调用……}
            end
          else
            Application.MessageBox('取入口地址失败','错误');
          {不用了,记得释放}
          freelibrary(handle1);    end;
    end;