Hi,
one trick to debug UDF.
 
Just stop Firebird service, and configure in Delphi for UDF as host
application firebird.exe with parameter -a.
 
Next just run UDF (firebird will be started as application), connect from
some sql console and call udf.
 
Also you can debug UDF in Delphi debuger as any other dll.
 
In your case, you will probably see the name of missing dll or another
exception related UDF loading/startup code.
 
Slavek
 

Ing. Slavomir Skopalik
Executive Head
Elekt Labs s.r.o.
Collection and evaluation of data from machines and laboratories
by means of system MASA (http://www.elektlabs.cz/m2demo)
-----------------------------------------------------------------
Address:
Elekt Labs s.r.o.
Chaloupky 158
783 72 Velky Tynec
Czech Republic
---------------------------------------------------------------
Mobile: +420 724 207 851
icq:199 118 333
skype:skopaliks
e-mail:skopa...@elektlabs.cz
http://www.elektlabs.cz <http://www.elektlabs.cz/>  

 

-----Original Message-----
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of firebirddev
firebirddev
Sent: Wednesday, October 16, 2013 8:54 PM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] UDF and Delphi XE3 Blues


  



Hello. 

I am unable to resolve the issue with UDF.

Does anyone have any other suggestions?

Thanks in advance.


2013/10/3 firebirddev firebirddev <firebird...@gmail.com>


Thanks Sean. 

The UDF/DLL is in located in the path described in the firebird.conf:
UdfAccess = Restrict D:\Apps\Firebird\Firebird_2_5\UDF;


Yes, "myDLL.dll' is 32-bit, However my FB installation is 64-bit.  I did
compile the dll to the 64-bit target and copied into the UDF folder.

The problem persists.  Any other clues?

Thanks.



2013/10/2 Leyne, Sean <s...@broadviewsoftware.com> 



  



 

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.
















Reply via email to