Subject
Author gbehnke2000
Dear Members,

i try to write a udf with cbuilder 6.
Here is my code.


#if defined(_BUILD_DLL)
# define DLL_EXP __declspec(dllexport)
#else
# if defined(_BUILD_APP)
# define DLL_EXP __declspec(dllimport)
# else
# define DLL_EXP
# endif
#endif

#include <stdio.h>
#include <string.h>
#include <alloc.h>
#include <ibase.h>


#define args args
#define ARG(type, arg) type arg
#define ARGLIST(arg)


typedef struct blob {
short (*blob_get_segment) ();
void *blob_handle;
long blob_number_segments;
long blob_max_segment;
long blob_total_length;
void (*blob_put_segment) ();
} *BLOB;

int DLL_EXP fn_compress_blob (ARG(BLOB, sourceBlob),ARG
(BLOB,destinationBlob))
ARGLIST(BLOB sourceBlob)
ARGLIST(BLOB destinationBlob)
{
char *buffer, *ptrBuffer;
long actual_length,b_length;

if (sourceBlob->blob_handle)
{

b_length = 1024 * 40;// sourceBlob->blob_max_segment + 1L;
buffer = malloc(b_length);

//eventuell mit realloc buffer dynamisch vergrößern

while ((*sourceBlob->blob_get_segment)
(sourceBlob-
>blob_handle,buffer,b_length,&actual_length));

if (b_length==actual_length)
actual_length = NULL;
else
{ // buffer should now include the complete rtf-document
ptrBuffer = buffer; // ptrBuffer to the beginning
// here should follow the compression routine
}

(*destinationBlob->blob_put_segment)(destinationBlob-
>blob_handle,buffer,actual_length);

// free the buffer
free(buffer);
}


return NULL;
}

After declaring the udf in FB 1.5 and trying to call the udf with

SELECT
TEXT_RTF,
fn_compress_blob(TEXT_RTF,TEXT_RTF)

from STAR_Document
where STAR_DOCUMENT.GUID_CHANGE='94796907'

i get the error
An error was found in the application program input parameters for
the SQL statement.
Dynamic SQL Error.
SQL error code = -804.
Function unknown.
FN_COMPRESS_BLOB.
Can anywhere help me ?

Many thanks in adavance
Gerhard