Subject Re: UDF: ib_util_malloc vs. malloc
Author vandy899
--- In, Pavel Menshchikov
<mpn2001@y...> wrote:
> Hello vandy899,
> v> Sorry to ask again, but what is the reason to use ib_util_malloc in a
> v> UDF that one declares FREE_IT to firebird? (I can't get firebird to
> v> like a UDF that has ib_util_malloc in it, but when I used malloc the
> v> problems 'mysteriously' disappeared. I'd say it couldn't dynamically
> v> link it... because ib_util_malloc isn't there! But ib_util_malloc
> v> isn't declared in (strings | grep
> v> ib_util_malloc), so what do I link to get ib_util_malloc?
> Probably, (in Windows FB version its name is ib_util.dll, I
> don't know *nix name exactly)?
> --
> Best regards,
> Pavel Menshchikov

I did a locate on ib_util, and only got ib_util.h in the include
files. That only contains a forward declaration for ib_util_malloc.
Further, a strings in /usr/lib on *.a and *.so (strings *.a *.so |
grep ib_util) leads to nothing. What file should I be linking to?

The file is reproduced below:
#include <stdio.h>
#include <stdlib.h>
#include <ibase.h>
#include <ib_util.h>

#define BUFFER_SIZE (100)
#define HIGH32MASK (0xFFFFFFFFULL << 32)

#define MALLOC malloc
#define MALLOC malloc /* Declared as ib_util_malloc before */

char * ISC_EXPORT prettyPrintInt64(ISC_UINT64 *in) {
char *retval = MALLOC(BUFFER_SIZE);
snprintf(retval,BUFFER_SIZE-1,"%llu -
return retval; // Free me

ISC_UINT64 ISC_EXPORT unPrettifyInt64(char *in) {
unsigned int a,b;
sscanf(in,"%u - %u",&a,&b);
return ((unsigned long long)a << 32) + b;

/* EOF */