Subject Re: [firebird-support] Creating UDF - stdcall vs cdecl
Author Carlos H. Cantu
Re: [firebird-support] Creating UDF - stdcall vs cdecl The link you pointed has incorrect information. When using Delphi, UDF functions should use cdecl not stdcall.

Delphi/Pascal gives you the necessary syntax and functions to work with pointers, so just get used to them <g>

Firebird Performance in Detail - -

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:

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.