Subject Re: UDF to provide Hexadecimal string
Author Steve Harp
--- In firebird-support@yahoogroups.com, "Adam" <s3057043@y...> wrote:
> --- In firebird-support@yahoogroups.com, "Steve Harp" <steve@h...>
> wrote:
> > --- In firebird-support@yahoogroups.com, "Ricardo Uzcategui"
> > <ricardouven@c...> wrote:
> > > it's easy. in delphi, you can make a udf with a function with
> this body:
> > >
> > > interface
> > >
> > > function IntToHex( var nNumber: integer ): pchar; cdecl; export;
> > >
> > >
> > >
> > > implementation
> > >
> > > function IntToHex( var nNumber: integer ): pchar;
> > > begin
> > > result := format('%1.2x',[nNumber])
> > > end;
> > >
> >
> > I created a Delphi DLL using your suggestion and placed it in the
> > Firebird UDF folder. I then declared it in me schema as so.
> >
> > declare external function IntToHex
> > integer
> > returns
> > cstring(254)
> > entry_point 'IntToHex' module_name 'XpressUDF.dll';
> >
> > and get the following error.
> >
> > ISC ERROR MESSAGE:
> > invalid request BLR at offset 116
> > function INTTOHEX is not defined
> > module name or entrypoint could not be found
> >
> > Any suggestions?
> > Steve
>
> Steve,
>
> In the main project file (the one with library as the first word),
> you need to have the following beneath
>
> "{$R *.res}"
>
> exports
> IntToHex;
>
> begin
> end.
>
>
>
> If it isn't listed as exports, it wont be a valid entry point and you
> wont be able to use it.

The exports statement was in there. My problem was that I had entered
module_name as 'XpressUDF.Dll' instead of 'XpressUDF' in my declaration.

Steve