开发者

Delphi Application Error with Ole in a DLL

开发者 https://www.devze.com 2023-01-10 05:49 出处:网络
I have a Com Object, setup/create/working from a DataModule. creating/running/freeing the Datamodule from an Application works with out an issue.

I have a Com Object, setup/create/working from a DataModule.

creating/running/freeing the Datamodule from an Application works with out an issue.

but putting the datamodule into a DLL works fine the first time, runing the com object etc.. but after a few calls with out restarting the application, this error appears.

Error Message image http://darkaxi0m.name/so/errormessage.GIF

There is a fare bit of code in the App, so i cant post it all, I have tried MadExcept in both the Application and Dll, with no luck. The IDE Breaks at a point that does not seem much help...

alt text http://darkaxi0m.name/so/cpubreak.gif

this is the code that handles the DataModule, the same function is used in the Application and the Dll in both tes开发者_开发技巧ts

function GetAmount( Amount : integer; var Info: PChar): integer; stdcall;
 var
  tempInfo: string;
   workerDM : TworkerDM;
 begin
  Result := 0;    
  workerDM := TworkerDM.Create(nil);
    try      
      tempInfo:= Info;
      Result := workerDM.GetAmount(Amount, tempInfo);
      StrPCopy(Info, tempInfo);
    finally
      workerDM.Free;
    end;
 end;

i would like to blame the Ole Object, but it works fine out of the Dll

I'm at a loss to even think where to start looking.


In the finally, you are calling Free, but should call workerDM.Free.


I don't believe this question can be answered any more. The project has be scraped, and the object that produce the error no longer used.

My Delete Requests have gone unanswered.

So this is now my answer.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号