Subject RE: [firebird-support] UDF By Reference
Author ibrahim bulut
Functions delphi declaration must be non pointer result value

function tcbGetIntValue(vValue: PInteger): Integer; cdecl;

and i use stdcall without problem





And udf declaration must use by value clause

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









_____

From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of redtneen
Sent: Tuesday, September 04, 2007 4:07 PM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] UDF By Reference



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



__________ NOD32 2504 (20070904) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com



[Non-text portions of this message have been removed]