Subject | UDF + FREE_IT + DISCONNECT |
---|---|
Author | Antoine Chevrette |
Post date | 2010-06-23T19:26:39Z |
Hello,
I have a simple UDF written in C that looks like this :
*_declspec(dllexport) char* fn_ltrim(char* s){
char *c;
c = ib_util_malloc(strlen(s)+ 1);
c = s;
if ( *s == VIDE ) return c;*
**
* while (*c && *c == BLANC) c++;
*
* return c;
}*
The UDF is declared like :
*DECLARE EXTERNAL FUNCTION LTRIM
CSTRING(256)
RETURNS CSTRING(256) FREE_IT
ENTRY_POINT 'fn_ltrim'
MODULE_NAME 'G:\GLINK\GLINKdll\FireBirdUDFs.dll';*
On windows server 2003 everything runs fine, then on windows server 2008
when I run the same code
firebird get disconnected. In order for it to work I have to get rid of the
FREE_IT statement in the
UDF declaration, so something like this works:
*DECLARE EXTERNAL FUNCTION LTRIM2
CSTRING(256)
RETURNS CSTRING(256)
ENTRY_POINT 'fn_ltrim'
MODULE_NAME 'G:\GLINK\GLINKdll\FireBirdUDFs.dll';*
Does anyone knows why it's doing that behaviour ? I process millions and
millions of records, I really need the free_it !
Thanks in advance
Antoine
[Non-text portions of this message have been removed]
I have a simple UDF written in C that looks like this :
*_declspec(dllexport) char* fn_ltrim(char* s){
char *c;
c = ib_util_malloc(strlen(s)+ 1);
c = s;
if ( *s == VIDE ) return c;*
**
* while (*c && *c == BLANC) c++;
*
* return c;
}*
The UDF is declared like :
*DECLARE EXTERNAL FUNCTION LTRIM
CSTRING(256)
RETURNS CSTRING(256) FREE_IT
ENTRY_POINT 'fn_ltrim'
MODULE_NAME 'G:\GLINK\GLINKdll\FireBirdUDFs.dll';*
On windows server 2003 everything runs fine, then on windows server 2008
when I run the same code
firebird get disconnected. In order for it to work I have to get rid of the
FREE_IT statement in the
UDF declaration, so something like this works:
*DECLARE EXTERNAL FUNCTION LTRIM2
CSTRING(256)
RETURNS CSTRING(256)
ENTRY_POINT 'fn_ltrim'
MODULE_NAME 'G:\GLINK\GLINKdll\FireBirdUDFs.dll';*
Does anyone knows why it's doing that behaviour ? I process millions and
millions of records, I really need the free_it !
Thanks in advance
Antoine
[Non-text portions of this message have been removed]