Subject | Re: [ib-support] UDF - C++ problem |
---|---|
Author | Andrew Guts |
Post date | 2002-06-18T17:50:38Z |
Antonie Ackerman wrote:
plain finctions like
extern "C" long __stdcall CalcDistance(long* OldLong, long* OldLat,
long* NewLong, long* NewLat) {}
LIBRARY dbutils
DESCRIPTION "dbutils - collection of UDFs"
EXPORTS
CalcDistance
Make sure you have placed your DLL into interbase UDF directory. Did you
read DevGuide.pdf from page 75 carefully?
Hope it helps.
Andrew
>Hi all,Is "CDBUtilsApp" a namespace? Do not use class member as an UDF, just
>
>I am using Firebird and Microsoft Visual C++ and want to use a UDF(C++ dll)
>to perform distance convertion in one of my Stored Procedures.
>
>I copied the dll to the Interbase\udf directory as described in the
>Developers manual.
>
>Function layout in dbutils.dll:
>long __stdcall CDBUtilsApp::CalcDistance(long OldLong, long OldLat, long
>NewLong, long NewLat)
>{
> long dDistance = 0;
> // Distance convertion
> ......
> return dDistance;
>}
>
>
plain finctions like
extern "C" long __stdcall CalcDistance(long* OldLong, long* OldLat,
long* NewLong, long* NewLat) {}
>Make sure you have created a .DEF file for your DLL like this:
>Stored Procedure:
>CREATE PROCEDURE SP_RPT_TEST_DLL (
> CURRLONG INTEGER,
> CURRLAT INTEGER,
> PREVLONG INTEGER,
> PREVLAT INTEGER)
>RETURNS (
> CALCDIST INTEGER)
>AS
>BEGIN
> CALCDIST = CALCDISTANCE(PREVLONG, PREVLAT, CURRLONG, CURRLAT);
>END
>
>
>
>UDF declaration:
>DECLARE EXTERNAL FUNCTION CALCDISTANCE
> INTEGER,
> INTEGER,
> INTEGER,
> INTEGER
> RETURNS INTEGER BY VALUE
> ENTRY_POINT 'CalcDistance' MODULE_NAME 'dbutils.dll';
>
>
>I get the following error message when trying to compile the SP
>Invalid token.
>Invalid request BLR at offset 52.
>Function CALCDISTANCE is not defined.
>Module name or entry could not be found.
>
>Any help would be appreciated.
>
>Antonie
>
>
LIBRARY dbutils
DESCRIPTION "dbutils - collection of UDFs"
EXPORTS
CalcDistance
Make sure you have placed your DLL into interbase UDF directory. Did you
read DevGuide.pdf from page 75 carefully?
Hope it helps.
Andrew