http://www.firebirdsql.org/index.php?op=useful&id=deatz_udf
koristim eclipse za win i gcc kompajler.
kreirao novi projekt, shared library dodao c file.
Code:
int modulo(int *, int *);
int modulo(a, b)
int *a;
int *b;
{
if (*b == 0)
return -1; // return something suitably stupid.
else
return *a % *b;
}
int modulo(int *, int *);
int modulo(a, b)
int *a;
int *b;
{
if (*b == 0)
return -1; // return something suitably stupid.
else
return *a % *b;
}
kompajlirao i dobio dll.
odradio sve ovo, uredno kreirao UDF.
In ISQL
declare external function f_Modulo
integer, integer
returns
integer by value
entry_point 'modulo' module_name 'mojlib';
commit;
kad probam izvršiti ovaj select
select f_Modulo(3, 2) from rdb$database;
dobijem gršku
Invalid token.
Invalid request BLR at offset 60.
Function F_MODULO is not defined.
Module name or entrypoint could not be found.