Board index » delphi » Writing UDF's for InterBase with Delphi 2.0

Writing UDF's for InterBase with Delphi 2.0

Hi your out in the space

I tried to create a DLL with Delphi 2.0 with some special functions for
the InterBase Server. My problem is that i can't pass any value through
the parameters. The return values are correct.

I made following definitions

DECLARE EXTERNAL FUNCTION ABC
CHAR(40), INTEGER
RETURNS INTEGER BY VALUE
ENTRY_POINT "ABS" MODULE_NAME "LIBRARY"

DLL-Source

function ABC(s: pChar, i: integer): integer;
begin
  ...
  ABC := xyz;
end;

Does someone know how to define vars s and i correct ?

Thanx
Tom

 

Re:Writing UDF's for InterBase with Delphi 2.0


Quote
Thomas Freudenberg (thom...@gun.de) wrote:

: Hi your out in the space

: I tried to create a DLL with Delphi 2.0 with some special functions for
: the InterBase Server. My problem is that i can't pass any value through
: the parameters. The return values are correct.

: I made following definitions

: DECLARE EXTERNAL FUNCTION ABC
: CHAR(40), INTEGER
: RETURNS INTEGER BY VALUE
: ENTRY_POINT "ABS" MODULE_NAME "LIBRARY"

: DLL-Source

: function ABC(s: pChar, i: integer): integer;
: begin
:   ...
:   ABC := xyz;
: end;

: Does someone know how to define vars s and i correct ?

How funny, i didn't even try to write a UDF in Pascal. (i am using C)
But in the Interbase-manuals you can find that every parameter passed
to Interbase has to be by Reference (like your pchar).

int ABC(char *s, int *i)
{
   ...
   ABC := xyz;

Quote
}

Hope this helps,
                Uwe

Re:Writing UDF's for InterBase with Delphi 2.0


Quote
Thomas Freudenberg wrote:
> DECLARE EXTERNAL FUNCTION ABC
> CHAR(40), INTEGER
> RETURNS INTEGER BY VALUE
> ENTRY_POINT "ABS" MODULE_NAME "LIBRARY"

> DLL-Source

> function ABC(s: pChar, i: integer): integer;
> begin
>   ...
>   ABC := xyz;
> end;

> Does someone know how to define vars s and i correct ?

Add a cdecl and a export to your function declaration

hope this helps

--

Robert Schieck
-----------------------------------------------------------------------
MER Systems Inc.

Client/Server Development and Training using Delphi,  InterBase and Oracle

InterBase page  http://www.mers.com/interbase.html
udflib page     http://www.mers.com/product.html
TDUG page       http://www.mers.com/tdug.html      -Toronto Delphi Users Group

Other Threads