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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ExitProc in library fails ?!

Status
Not open for further replies.

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 ?
 
Just a guess - it may need to be defined as a far procedure:

procedure LibExit; far;
TealWren
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top