Subject problem with UDF in 64 bits Firebird
Author Sergio
Hello! I had a very simple UDF which I used in my 32 bits app, now I've changed the PC, and installed FB 64, and the UDF stopped working.

I get this message:

can't format message 13:896 -- message file C:\Windows\firebird.msg not found.
invalid request BLR at offset 59.
function SG_DES is not defined.
module name or entrypoint could not be found.

I googled it and I found that I should compile the DLL to 64 bits... I did it. I use Delphi XE2, but the problem continues

This is the declaration of the udf:

DECLARE EXTERNAL FUNCTION SG_DES
DOUBLE PRECISION,
CSTRING(50)
RETURNS DOUBLE PRECISION BY VALUE
ENTRY_POINT 'Descuentos' MODULE_NAME 'SGUDF';

I know that this is not a Delphi forum, but just in case, this is the code

library SGUDF;

uses
SysUtils,
Classes,
uDLL in 'uDLL.pas';

{$R *.res}

exports
Descuentos;

begin
end.

-------

unit uDLL;

interface

uses Classes, StrUtils, SysUtils;

type TImportes = array of currency;

function String2Currs(const s: string): TImportes;

function Descuentos(var Suma:double;Descuentos:pchar):double; cdecl; export;


implementation

function Descuentos(var Suma:double;Descuentos:pchar):double;
var Desc: TImportes; i: integer;
begin
result := Suma;

Desc :=
String2Currs(
StringReplace(
StringReplace(Descuentos,',',' ',[rfReplaceAll]),
'.',DecimalSeparator,[rfReplaceAll]));

for i := 0 to High(Desc) do
begin
result := result + ( result * Desc[i] / 100);
end;
end;

function String2Currs(const s: string): TImportes;
var list: TStringList; i: Integer; st: string;
begin
st := s;
SetLength(Result, 0);
list := TStringList.Create;

try

list.Delimiter := ' ';

if LeftStr(st,1) = list.Delimiter then
st := Copy(st,2,Length(st)-1);

if RightStr(st,1) = list.Delimiter then
st := Copy(st,1,Length(st)-1);

list.DelimitedText := Trim(st);
SetLength(Result,list.Count);

for i := 0 to list.Count-1 do
Result[i] := StrToCurrDef(list[i],0);

finally
list.Free;

end;

end;

end.