EricDraven
Programmer
Hi all,
Because quickreports combined with all the code required to generate my reports adds so much to the executable size, I have set up every report as a DLL. The DLL's are called using the following code
var
Listing : procedure (My Variable);
MyLib : THandle;
begin
MyLib := LoadLibrary(PChar(ExtractFilePath(Application.Exename) + 'MyDLL.dll'));
if (MyLib <> 0) then
begin
try
@Listing := GetProcAddress(MyLib, PChar('Listing'));
if Assigned(Listing)then Listing(My Variables);
finally
FreeLibrary(MyLib);
end;
end;
end;
This loads the DLLs fine, but after a while users are beginning to get errors in the main application (i.e Table is Busy). All of my DLL's access tables and I create 1 or more forms in the called DLL procedure for quickreports etc.
What is the correct procedure in the DLL for closing and freeing it from memory? Or is there something amiss with the way I call the DLL's (I am aware of ShareMem). One such error has just occured after repeatedly opening and closing the DLL's stating that there have been too many exceptions??? Another thing worth mentioning is that one of my DLL's waits for user interaction before previewing the QuickRep and this DLL can be closed and opened as many times as I wish provided the QuickRep isnt previewed???
Arte Et Labore
Because quickreports combined with all the code required to generate my reports adds so much to the executable size, I have set up every report as a DLL. The DLL's are called using the following code
var
Listing : procedure (My Variable);
MyLib : THandle;
begin
MyLib := LoadLibrary(PChar(ExtractFilePath(Application.Exename) + 'MyDLL.dll'));
if (MyLib <> 0) then
begin
try
@Listing := GetProcAddress(MyLib, PChar('Listing'));
if Assigned(Listing)then Listing(My Variables);
finally
FreeLibrary(MyLib);
end;
end;
end;
This loads the DLLs fine, but after a while users are beginning to get errors in the main application (i.e Table is Busy). All of my DLL's access tables and I create 1 or more forms in the called DLL procedure for quickreports etc.
What is the correct procedure in the DLL for closing and freeing it from memory? Or is there something amiss with the way I call the DLL's (I am aware of ShareMem). One such error has just occured after repeatedly opening and closing the DLL's stating that there have been too many exceptions??? Another thing worth mentioning is that one of my DLL's waits for user interaction before previewing the QuickRep and this DLL can be closed and opened as many times as I wish provided the QuickRep isnt previewed???
Arte Et Labore