简体   繁体   中英

Delphi Application Error with Ole in a DLL

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 tests

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.

finally ,您将调用Free ,但应调用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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM