Guest_imported
New member
- Jan 1, 1970
- 0
Well .. im trying to install a new handler for the exitProc in a library but it simply won't work
code:
library test;
uses
SysUtils,
Classes,
dialogs;
var
SaveExit: Pointer;
procedure LibExit;
begin
MessageDlg('Unloading dll',mterror,[mbok],0);
ExitProc := SaveExit; // restore exit procedure chain
end;
begin
SaveExit := ExitProc; // save exit procedure chain
ExitProc := @LibExit; // install LibExit exit procedure
MessageDlg('Loading dll',mterror,[mbok],0);
end.
with two consecutive calls from within an app like this:
LoadLibrary(MyHandle,'test.dll');
FreeLibrary(MyHandle);
it only shows the 'Loading dll' dialog .. it isn't executing the installed proc at all.
what's the catch ?
code:
library test;
uses
SysUtils,
Classes,
dialogs;
var
SaveExit: Pointer;
procedure LibExit;
begin
MessageDlg('Unloading dll',mterror,[mbok],0);
ExitProc := SaveExit; // restore exit procedure chain
end;
begin
SaveExit := ExitProc; // save exit procedure chain
ExitProc := @LibExit; // install LibExit exit procedure
MessageDlg('Loading dll',mterror,[mbok],0);
end.
with two consecutive calls from within an app like this:
LoadLibrary(MyHandle,'test.dll');
FreeLibrary(MyHandle);
it only shows the 'Loading dll' dialog .. it isn't executing the installed proc at all.
what's the catch ?