Subject UDF
Author Sergio
Hello, this is related to my previous post... I'm trying to write a UDF in Delphi... It's declared like this:

interface

function Descuentos(var Suma:currency;Descuentos:pchar):double; cdecl; export;

implementation

function Descuentos(var Suma:currency;Descuentos:pchar):double;
begin
// JUST TRYING...
result := Suma;
end;

In FB is declared like this:

DECLARE EXTERNAL FUNCTION SG_DES
DOUBLE PRECISION,
CSTRING(50)
RETURNS DOUBLE PRECISION BY VALUE
ENTRY_POINT 'Descuentos' MODULE_NAME 'SGUDF';

And if I do this:

select sg_des(precio,''), precio from stock where precio <> 0

the first column brings values like this:

462238206754239.312
462128431513322.125
463114860569204.625

this select

select sg_des(1,'') from rdb$database

shows this

460718241880001.75

what I'm doing wrong??

Thanks!!!

-sergio