Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AV from TQuery in a runtime package

Status
Not open for further replies.

donvittorio

Programmer
Jul 17, 2003
122
GB
Hi,

I am trying to create a runtime package which will contain classes that my main application can use, but I'm having problems with the data access.
My main app contains a TDatabase which points to a BDE alias. At runtime my package is dynamically loaded, and a method invoked in the package which creates a TQuery and opens it, populates an object with the returned data and then returns the object to the main app. The TQuery uses the TDatabase in the main app to connect to the database.
All this works fine, but when I close the main app I get an access violation: "Project C:\...GUI.exe faulted with message 'access violation at 0x7c9102db: write of address 0x00040ffc'. Process Stopped. Use Step or Run to continue".
If I create the TQuery but don't open it then this error does not occur. I have no idea why this error occurs! My TQuery is closed and freed ok, my package is unloaded ok, but after the form in my main app is destroyed this error occurs.
I'm using Delphi 5 BTW, I've tried to be brief so if I have missed any helpful info let me know, any ideas gratefully received.

Thanks

Steve

p.s. I know that using Delphi 5 and BDE is archaic but I'm stuck with it for now!
 
do you really NEED the runtime packages?

/Daddy

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Not really, we could just put the classes in the exe, but it's plug-in functionality that we will charge extra for, so we wanted to be able to deliver it separately.
It also means that we separate our 'model' from our 'view'.
 
compile your program without runtime packages and debug with the IDE?

/Daddy

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Unfortunately I have to build my program with runtime packages and have vclado50 in the list (this is the only one I have in the list), otherwise when the package tries to create a TQuery I get 'Application is not licensed to use this feature'. That's another bizarre problem, there are no ADO components in my app or my package, and I have created them both with Delphi 5 Enterprise.
If I build using runtime packages then I can debug all the way through to the end, and it falls over after the 'end.' line in the project source.

Code:
begin
  Application.Initialize;
  Application.CreateForm(TDataModule1, DataModule1);
  Application.CreateForm(TfrmGUIMain, frmGUIMain);
  Application.Run;
end.  //gets to this line ok, then error occurs when i run or step over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top