Subject UDF By Reference
Author redtneen
Hi

I wrote UDF in Delphi and tried this function

function tcbGetIntValue(vValue: PInteger): PInteger; cdecl; export;
begin
ResultInteger := vValue^ * 2;
Result := @ResultInteger;
vValue^ := vValue^ + 1;
end;

it's declaration

declare external function GetIntValue
integer
returns
integer
entry_point 'tcbGetIntValue' module_name 'tcbReportsUDF.dll';

then i tried this statement

execute block
returns
(
res integer
)
as
declare variable val integer;
begin
res = 10;
val = GetIntValue(res);
suspend;
res = val;
suspend;
end

Result is:

Res
10
20

i expected to be
Res
11
20

because all input parameters in UDF are calling by Reference
can any one help me to understand this point ??????

my regards