Subject | Re: UDF: ib_util_malloc vs. malloc |
---|---|
Author | vandy899 |
Post date | 2005-08-07T13:44:37Z |
--- In firebird-support@yahoogroups.com, Pavel Menshchikov
<mpn2001@y...> wrote:
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 LOW32MASK (0xFFFFFFFFULL)
#define HIGH32MASK (0xFFFFFFFFULL << 32)
#ifdef DEBUG_BUILD_EXE
#define MALLOC malloc
#else
#define MALLOC malloc /* Declared as ib_util_malloc before */
#endif
char * ISC_EXPORT prettyPrintInt64(ISC_UINT64 *in) {
char *retval = MALLOC(BUFFER_SIZE);
snprintf(retval,BUFFER_SIZE-1,"%llu -
%llu",((*in)&HIGH32MASK)>>32,(*in)&LOW32MASK);
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 */
Cheers,
Michael
<mpn2001@y...> wrote:
> Hello vandy899,I did a locate on ib_util, and only got ib_util.h in the include
>
> 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 libfbclient.so (strings libfbclient.so | grep
> v> ib_util_malloc), so what do I link to get ib_util_malloc?
>
> Probably, ib_util.so (in Windows FB version its name is ib_util.dll, I
> don't know *nix name exactly)?
>
>
> --
> HTH
> Best regards,
> Pavel Menshchikov
> http://www.ls-software.com
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 LOW32MASK (0xFFFFFFFFULL)
#define HIGH32MASK (0xFFFFFFFFULL << 32)
#ifdef DEBUG_BUILD_EXE
#define MALLOC malloc
#else
#define MALLOC malloc /* Declared as ib_util_malloc before */
#endif
char * ISC_EXPORT prettyPrintInt64(ISC_UINT64 *in) {
char *retval = MALLOC(BUFFER_SIZE);
snprintf(retval,BUFFER_SIZE-1,"%llu -
%llu",((*in)&HIGH32MASK)>>32,(*in)&LOW32MASK);
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 */
Cheers,
Michael