Subject UDF - C++ problem
Author Antonie Ackerman
Hi all,

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;
}


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