Subject Re: [IBO] UDF Parameter Bug in IBO ????
Author Jason Wharton
What version of IBO are you using?
Part of the problem has to do with me using the extended type in delphi to
contain the value rather than a double. This is an area I've only partially
addressed with the 3.4 release. Perhaps what I did in this release will be
sufficient. Please get the latest and let me know. Use the eval version if
you need to.

Thanks,
Jason Wharton

----- Original Message -----
From: "Helmut Steinberger" <ibo@...>
To: <IBObjects@yahoogroups.com>
Sent: Monday, November 17, 2003 2:47 AM
Subject: [IBO] UDF Parameter Bug in IBO ????


> Hello,
>
> I think I discovered a bug, when using UDFs.
> I use several UDFs, which I build by myself. Until I changed to FB1.5
> all UDFs worked well as expected, but now I discovered a strange
> behavior.
> I think IBO interprets the datatype of the paramters passed to the UDF
> wrong.
> The first and second parameter is interpreted right, but every further
> parameter is interpreted as the same type like the 2nd parameter.
>
> I give you an example to understand what I meen:
>
> The Pascal Code of the UDF :
>
> function test_udf (var intparam : integer;
> var intparam2 : integer;
> var doubleparam : double) : double; stdcall;
>
> begin
> doubleparam := (doubleparam + intparam + intparam2) / 2;
> result := doubleparam;
> end;
>
> The UDF is declared to FB like that:
>
> DECLARE EXTERNAL FUNCTION TEST_UDF
> integer,
> integer,
> double precision
> RETURNS double precision BY VALUE
> ENTRY_POINT 'test_udf' MODULE_NAME 'testlib'^
>
>
> When I pass the following statement
>
> select test_udf (1, 2, 2.9) from rdb$database in IBConsole I get the
> correct result 2.95
>
> Doing the same in EMS Interbasemanager also brings the same result.
>
> When I now change the statement to
> select test_udf (:a, :b, :c) from rdb$database
>
> I will be asked to enter the 3 parameters.
>
> I enter 1 for :a, 2 for :b and 2.9 for :c then I get the result 2.5
>
> The same problem occures, when I use it within my application,
> designed with IBO.
>
> I use IBO 4.3 and FB 1.5 RC7
>
> cu
> Helmut