Hi,

Yes you must uae cdecl but pass integer as var not pointer, use pansistring not 
string (unicode), use iballoc 

All is very simple to write in delphi
i wrote many udf,s without problem

Regards,
Karol Bieniaszewski



----- Reply message -----
Od: "hamacker [email protected] [firebird-support]" 
<[email protected]>
Do: <[email protected]>
Temat: [firebird-support] Creating UDF - stdcall vs cdecl
Data: wt., paź 7, 2014 14:21
Hi everyone,
I am studying how to create UDFs on Firebird, but there is a thing that I can 
not understand.

Samples that I found over internet, like this:
http://www.firebirdsql.org/en/writing-udfs-in-delphi-for-interbase-firebird/

All functions are exported as stdcall:function Teste(sVar:PAnsiChar; 
iVar:Integer):PAnsiChar; stdcall ;

I dont use string, only pAnsiChar, Integer and Double.Ok, at this point, but 
when register inside Firebird and execute, the app (flamerobin or ibexpert) 
crash. 
Then, I change to export function DLL as cdecl and change Integer type to 
Integer as Pointer:type PInteger = ^Integer;function Teste(sVar:PAnsiChar; 
iVar:PInteger):PAnsiChar; cdecl;

runs fine, but I have very difficult to handle with pointers (hello pascal).
I can´t make a simple 'hello word' using stdcall functions. Even copy samples 
over internet.I use Delphi XE5 and FB 2.5.3.
I would like to know if is possible to work writting UDFs as stdcall or I have 
to adapter with cdecl and pointers to make my own UDFs.
Thx,






Reply via email to