Subject | UDF help |
---|---|
Author | Kjell Rilbe |
Post date | 2005-02-11T06:57:40Z |
Hi,
Tried to create a simple test UDF, but it doesn't work.
In Delphi7:
------------------------------------
library AMUDF;
{$R *.res}
type
PInteger = ^Integer;
function Add(var a, b: PInteger): Integer; stdcall;
begin
if Assigned(a) and Assigned(b)
then Result:=a^+b^
else Result:=0;
end;
exports Add;
begin
end.
------------------------------------
In FB:
------------------------------------
declare external function AMAdd
Integer,
Integer
returns
Integer by value
entry_point 'Add'
module_name 'AMUDF.dll'
------------------------------------
Then I try this:
------------------------------------
select first 1
"RDB$RELATION_ID",
"RDB$SYSTEM_FLAG"
from "RDB$RELATIONS"
------------------------------------
Which returns:
------------------------------------
0 1
------------------------------------
Fine, then I add a line in the SQL:
------------------------------------
select first 1
"RDB$RELATION_ID",
"RDB$SYSTEM_FLAG",
AMAdd("RDB$RELATION_ID", "RDB$SYSTEM_FLAG")
from "RDB$RELATIONS"
------------------------------------
Which returns:
------------------------------------
*** IBPP::Exception inside Statement::Prepare ***
IBPP said : isc_dsql_prepare failed.
SQL Message : -804
An error was found in the application program input parameters for the
SQL statement.
Engine Code : 335544569
Engine Message :
Dynamic SQL Error
SQL error code = -804
Function unknown
AMADD
Execute time: 00:00:00.
------------------------------------
What's the problem here? What am I doing wrong? Any special
compiler/linker options I need to set in Delphi?
(What I was originally trying to do was to create a substitute for the
non-existent POSITION function.)
Thanks,
Kjell
--
--------------------------------------
Kjell Rilbe
Adressmarknaden AM AB
E-post: kjell.rilbe@...
Telefon: 08-761 06 55
Mobil: 0733-44 24 64
Tried to create a simple test UDF, but it doesn't work.
In Delphi7:
------------------------------------
library AMUDF;
{$R *.res}
type
PInteger = ^Integer;
function Add(var a, b: PInteger): Integer; stdcall;
begin
if Assigned(a) and Assigned(b)
then Result:=a^+b^
else Result:=0;
end;
exports Add;
begin
end.
------------------------------------
In FB:
------------------------------------
declare external function AMAdd
Integer,
Integer
returns
Integer by value
entry_point 'Add'
module_name 'AMUDF.dll'
------------------------------------
Then I try this:
------------------------------------
select first 1
"RDB$RELATION_ID",
"RDB$SYSTEM_FLAG"
from "RDB$RELATIONS"
------------------------------------
Which returns:
------------------------------------
0 1
------------------------------------
Fine, then I add a line in the SQL:
------------------------------------
select first 1
"RDB$RELATION_ID",
"RDB$SYSTEM_FLAG",
AMAdd("RDB$RELATION_ID", "RDB$SYSTEM_FLAG")
from "RDB$RELATIONS"
------------------------------------
Which returns:
------------------------------------
*** IBPP::Exception inside Statement::Prepare ***
IBPP said : isc_dsql_prepare failed.
SQL Message : -804
An error was found in the application program input parameters for the
SQL statement.
Engine Code : 335544569
Engine Message :
Dynamic SQL Error
SQL error code = -804
Function unknown
AMADD
Execute time: 00:00:00.
------------------------------------
What's the problem here? What am I doing wrong? Any special
compiler/linker options I need to set in Delphi?
(What I was originally trying to do was to create a substitute for the
non-existent POSITION function.)
Thanks,
Kjell
--
--------------------------------------
Kjell Rilbe
Adressmarknaden AM AB
E-post: kjell.rilbe@...
Telefon: 08-761 06 55
Mobil: 0733-44 24 64