Question

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.

Was it helpful?

Solution 2

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top