i tried create simple user defined function (udf) firebird 2.5 c++ builder 2010 don't manage work in firebird.
- creating dll project default setting in c++ builder 2010.
adding unit example udf including "ibase.h" , "ib_util.h":
extern "c" __declspec(dllexport) int __stdcall myfunc ( int ) { int result = 2 * i; return result; }
building dll
fbudfmbd.dll
in pathc:\program files (x86)\firebird\firebird_2_5\udf
registering udf via ibexpert in sample db
declare external function f_myfunc integer returns integer entry_point 'myfunc' module_name 'fbudfmbd';
calling udf
select f_myfunc( 3 ) rdb$database;
results in error message
invalid token. invalid request blr @ offset 36. function f_myfunc not defined. module name or entrypoint not found.
with tool gexperts - pe information can see udf dll-export myfunc
ordinal $1
, entry point $1538
.
what doing wrong, firebird can't register dll , udf correctly?
is there in dll project change regarding default compiler options?
thanks lot! got help.
top 2: corrected c++-code is:
extern "c" __declspec(dllexport) int myfunc ( int * val ) { int result = 2 * *val; return result; }
pay attention reference call of input parameter.
top 4: register udf in firebird 2.5 db
declare external function f_myfunc integer returns integer value entry_point '_myfunc' module_name 'fbudfmbd';
pay attention leading underscore @ function name!
top 5: select f_myfunc( 3 ) rdb$database;
works fine!
Comments
Post a Comment