我做个无模式dll,其中有两个function暂且叫做A和B,A调用B,A作为exports接口
定义说明如下:
function B():integer;
function A(data:array of integer;number:integer):integer;stdcall
exports 
  A index 1;
其中A调用B,A作为dll的接口
在host程序中调用dll代码如下:
var
 myfunction:Tmyfunction;handle=loadlibrary(mydll);
if handle<>0 then
   begin
     @myfunction=getprocedure(handle,'A');//可执行到此处
     if @myfunction<>nil then
        begin
          result:=myfunction(aa,bb); //没有执行此处 
        end;
   end;
问题如下:
  为什么没有执行result:=myfunction(aa,bb); 这句代码
我做的其他无模式dll都可以成功,不同之处就是,这次的dll多了一个function(就是B了)
function A多了个参数
有什么问题吗?请各位达人指点,谢谢!

解决方案 »

  1.   

    var
     myfunction:Tmyfunction;handle=loadlibrary(mydll);
    if handle<>0 then
       begin
         @myfunction=getprocedure(handle,'A');//可执行到此处
         if myfunction<>nil then  //这句改成这样
            begin
              result:=myfunction(aa,bb); //没有执行此处 
            end;
       end;
      

  2.   

    @myfunction=GetProcAddress(handle,'A');//可执行到此处應該是用GetProcAddress吧
      

  3.   

    用GetProcAddress
      楼主应该把dll中a调用b的方法帖出来,看是否是那儿有问题