FreeLibrary, madExcept and win8

delphi package - automated exception handling
fpiette
Posts: 7
Joined: Tue Jan 07, 2020 1:47 pm
Contact:

Re: FreeLibrary, madExcept and win8

Post by fpiette »

Here attached if a very simple DLL and calling application.
When madExcept is enabled, FreeLibrary freeze the application.
Whitout madExcept, everything is OK.
Attachments
MadExceptFreeLibrary_TestProject.zip
(60.46 KiB) Downloaded 294 times
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: FreeLibrary, madExcept and win8

Post by madshi »

Thanks! How urgent is this? I'm currently busy with another project. Was planning to work on a new madExcept builds later this month or early February. Can it wait that long, or is it urgent?
fpiette
Posts: 7
Joined: Tue Jan 07, 2020 1:47 pm
Contact:

Re: FreeLibrary, madExcept and win8

Post by fpiette »

It is not very urgent. Later this month is OK.
Thanks
fpiette
Posts: 7
Joined: Tue Jan 07, 2020 1:47 pm
Contact:

Re: FreeLibrary, madExcept and win8

Post by fpiette »

Any news about this issue?
Thanks.
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: FreeLibrary, madExcept and win8

Post by madshi »

Hi there, and my apologies for taking so long. So here's a new build:

http://madshi.net/madCollectionUpdate.exe

You need to do 2 changes in your test project:

1) In the DLL dpr add the following line: "exports FinalizeMadExcept;".

2) In the EXE form pas change the code as follows:

Code: Select all

procedure TFreeLibraryFreeze.FreeLibraryButtonClick(Sender: TObject);
var Dll_FinalizeMadExcept : procedure;
begin
    if LibHandle = 0 then begin
        ShowMessage('Library not loaded');
        Exit;
    end;

    Dll_FinalizeMadExcept := GetProcAddress(LibHandle, 'FinalizeMadExcept');
    if @Dll_FinalizeMadExcept <> nil then
      Dll_FinalizeMadExcept;
    FreeLibrary(LibHandle);
    ShowMessage('Success!');
    LibHandle := 0;
end;
Together with the new madExcept build this should fix the problem. At least it does here, testing 32bit compiling with XE8.
fpiette
Posts: 7
Joined: Tue Jan 07, 2020 1:47 pm
Contact:

Re: FreeLibrary, madExcept and win8

Post by fpiette »

Thanks you so much.
I will try this fix and comes back here if I still have issue. No reply from me means everyting is OK.
btw: I'm using Delphi 10.3.4.

François Piette
Embarcadero MVP
Post Reply