C++的DLL  函数BOOL  WINAPI Write();我是这样调用的Twrite= function ():integer;Moudle:=loadlibrary('xxx.dll');
  try
    if Moudle>32 then
      @Write:= GetProcAddress(moudle,'Write');
      if not( @Write = nil ) then
      id:=Write;
       showmessage(inttostr(id));
      if id=0 then
        showmessage('不成功')
      else
        showmessage('成功');
  finally
    FreeLibrary(moudle);
  end;
请问这样调用对不对
执行结果i=1   显示成功 
我想应该是成功了吧  但没能实现想要的效果

解决方案 »

  1.   

    试下:Twrite= function ():integer;stdcall;Moudle:=loadlibrary('xxx.dll');
      try
        if Moudle>0 then
          @Write:= GetProcAddress(moudle,'Write');
        if @Write <> nil then
         id:=Write;
        //......
      

  2.   

    最好还是单步跟踪你的代码吧,id这个变量,初始化了没有,是否确定调用了id:=Write;如果确定调用了,那就检查一下dll中的函数吧