The code is a bit involved because it supports multiple versions of Firebird and multiple OSes. However, the windows version calls this function to get the buffer returned by FREE_IT:
static char * GetResultBfr (int len) { return ((char *) ib_util_malloc (len)); } My DLL is linked to the ib_util.dll using an import library. So it is statically linked to the DLL but not to the underlying object files. I already checked the system in question and there are no stray copies of ib_util.dll floating around. Just the one in the Firebird installation directory.