Subject UDF problems..
Author vandy899
Having problems with ib_util_malloc on Firebird 1.5.1. For some
reason substituting malloc works, but I'd like to know the
consequences, if any. The function is reproduced below; uses GCC long
long, printf "%ll" extensions.

#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 /* this was 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;
}

With ib_util_malloc substituted, I got messages about loading the UDF
being prohibited by the administrator. The Makefile instructions:

BT_UDFOBJECTS = int64pretty.o myusername.o
BT_UDFOUT = bt_udf.so
BT_UDFLIBFLAGS = #-Lfbclient # tried with and without

.PHONY: clean

$(BT_UDFOUT) : $(BT_UDFOBJECTS)
$(CC) $(CFLAGS) -shared $(BT_UDFLIBFLAGS) -o $(BT_UDFOUT)
$(BT_UDFOBJECTS)
# strip $(BT_UDFOUT) # Had this in before, tried commenting to
get to the bottom of it.

clean:
rm -f $(BT_UDFOUT) $(BT_UDFOBJECTS)

Cheers,

Michael