Subject | Re: [firebird-support] UDF and Delphi XE3 Blues |
---|---|
Author | firebirddev firebirddev |
Post date | 2013-10-03T17:19:44Z |
Are you sure that the UDF/DLL is in the %Firebird%\UDF folder?
Are you trying to run a 32bit UDF with a 64 bit version of Firebird?
Sean
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of firebirddev firebirddev
Sent: Wednesday, October 02, 2013 3:13 PM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] UDF and Delphi XE3 Blues
Hello.
If this is not the right group, kindly direct me to the right group.
I have created a UDF and I am getting stuck at the following error:
Preparing query: select F_MODULO(3, 2) from rdb$database
Error: *** IBPP::SQLException ***
Context: Statement::Prepare( select F_MODULO(3, 2) from rdb$database
)
Message: isc_dsql_prepare failed
SQL Message : -104
Invalid token
Engine Code : 335544343
Engine Message :
invalid request BLR at offset 60
function F_MODULO is not defined
module name or entrypoint could not be found
Total execution time: 0.003s
Here are the steps I have performed:
===============
Delphi XE3 code
================
library myUDF;
{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }
uses
System.SysUtils,
System.Classes;
//{$R *.res}
function Modulo(var i, j: Integer): Integer; cdecl;
begin
if (j = 0) then
result := -1 // just check the boundary condition, and
// return a reasonably uninteresting answer.
else
result := i mod j;
end;
exports
Modulo;
begin
end.
==============
FB 2.5 declaration
==============
DECLARE EXTERNAL FUNCTION F_MODULO
Integer, Integer
RETURNS Integer BY VALUE
ENTRY_POINT 'Modulo'
MODULE_NAME 'myDLL';
==============================
Calling the function F_MODULO from FB:
===============================
select F_MODULO(3, 2) from rdb$database
====================
My firebird.conf looks like:
=====================
UdfAccess = Restrict D:\Apps\Firebird\Firebird_2_5\UDF;
Please let me know how I can resolve the problem.
Thanks.