Subject Integer Parameters in UDF
Author kfoinfo
Hi there,
I am new to InterBase, trying to check out its features. Actually
I am dealing with an udf-problem, which I suppose to be a very basic
one. But the IB docs do not offer a solution to it, so I hope someone
will give me a hint.

I wrote a function
extern "C" { int _export udftest(int arg1);};

int udftest(int a)
{
int rc = 0;
if(a)
rc = 1L;

return rc;
}

(The function is ok as tested from an application.)
This was compiled (Borland C++ 5.0.2) to a myudflib.dll, which I put
to the udf-directory.

In Interbase I declared
DECLARE EXTERNAL FUNCTION F_UDFTEST
INTEGER
RETURNS INTEGER BY VALUE
ENTRY_POINT 'udftest' MODULE_NAME 'myudflib';

Calling the udf from IBConsole or IBWorkbench, it ALWAYS returns 1, no
matter if I put 0 or 1 as argument. I found out, that the parameter
<a> in the udftest-function is not initialized (some random value).
The function works with string-parameters, however.

So what's wrong with my integer datatype?

Regards