Subject AW: [firebird-support] FireBird 3.0.3 embedded is crashing when using an UDF function which returns a CSTRING
Author Jelich, Michael
Hi support team,

I've found the problem and a solution ­čśŐ

Just to clarify if anybody other has the same problem:
- I have a process performing firebird database updates
- currently it uses FireBird 2 Embedded only
- now this process has to make the database become a firebird 3 database during update
- for that it makes a backup using FB2, switch to FB3 and do the restore using FB3 (both embedded)
- the fbclient.dll as well as the UDF are unloaded properly before switching to Firebird 3 folder
- but I recognized that after switch to FB3 the ib_util.dll is loaded twice in my process (one from FB2, the other from FB3)
- this must have been the reason that the call to ib_util_malloc inside the UDF failed and forced the process to exit
- I completed the FB2->FB3 switch by a call to FreeLibrary which successfully unloads the FB2-ib_util.dll
- the handle for the FreeLibrary-call is determined via CreateToolHelp32SnapShot(TH32CS_SNAPMODULE, 0)

The reason because I get the same error in ibExpert seems to be that this process also has two ib_utils.dll's loaded: one from an internal used FB2 Embedded frolder, the other from the configured FB3 embedded folder.

Probably it makes sense to change the fbclient.dll in a way that it recognizes such a situation and use the correct ib_util.dll (e.g. having the same version as fbClient.dll or residing in the same folder...).

Thanks for your support.

Best regards

-----Urspr├╝ngliche Nachricht-----
Von: []
Gesendet: Montag, 23. Juli 2018 11:31
Betreff: Re: [firebird-support] FireBird 3.0.3 embedded is crashing when using an UDF function which returns a CSTRING

Email Security Warning:

The following message was sent from an external e-mail address. Exercise caution when opening attachments, clicking links, or exchanging information.

23.07.2018 8:54, 'Jelich, Michael' Michael.Jelich@... [firebird-support] wrote:
> Yes, it does. The dpr code is as follows:
> begin
> System.IsMultiThread := true;
> Randomize;
> end.

Did you check that this code is really executed? I'm sure about execution of initialization sections in libraries, but not about the main code block.





Visit and click the Documentation item
on the main (top) menu. Try FAQ and other links from the left-side menu there.

Also search the knowledgebases at


Yahoo Groups Links