Delphi firemonkey graphic dll TPlatformServices exception on freelibrary

  

I have a big issue with a Firemonkey DLL in RAD Studio 10.1 Berlin.

I followed other solutions, like this one, without success.

I tried to use WinApi.GDIPapi and WinAPI.GDIPObj without changing behavior.

The DLL file is simple:

function(pansichar):pansichar;
begin
create Form
form.showModal
form.free (I also tried FreeAndNil(Form)).
end;

When I unload the DLL with FreeLibrary(), I always get this result:

Call stack:

:02C76A7E TPlatformServices.SupportsPlatformService + $1E
:02A69D2F TpresentedTextControl.Destroy+$43
:5005f79f TObject.Free + $B
:5005f79f TObject.Free + $B (this is not an typo, it’s an repetition)
:02c0ef9c TStyleContainer.Destroy + $38
:02c505ff FinalizeForms + $F
:50061745 @Halt0+$AD

Event log:

First chance exception at $02C76A7E. Exception class $C00000005 with message ‘access violation at 0x02C76A7E: read of address 0x0000000004’.

In the debugger’s EventLog, the last unload is on Normaliz.dll.

The strange thing is, when I don’t unload the DLL, the application runs fine on some systems (on my Windows 10 dev PC, and a Windows 7 VM, it runs fine), but on other systems, it crashes on application exit.

I’ve tried also with a VCL form in a VCL DLL, a VCL form in a FMX DLL, and a bash executable with an FMX form.

I’ve tried also manually initializing GDI+ in the host application and in the DLL functions, without success.

There are two forms: a main form and a virtual keyboard form (which isn’t instantiated on my tests, so there is only one form instantiated).

Does anyone have experience on this issue, or any suggestions?

Comments are closed.