Subject | Re: [firebird-support] UDF doesn't work - Delphi/fpc |
---|---|
Author | Helen Borrie |
Post date | 2007-09-10T10:32:54Z |
At 08:12 PM 10/09/2007, you wrote:
2. declare the strings not as varchar but as the special interface
type cstring.
./heLen
>fb 2.011. Use cdecl calling convention, not stdcall.
>
>function YDA_StrNPos(ASubStr, AStr: PChar; var AOccurrenceNo:
>LongInt): LongInt; stdcall; export;
>begin
> Result := StrNPos(String(ASubStr), String(AStr), LongInt(AOccurrenceNo));
>end;
>
>declare external function YDA_StrNPos
>varchar(255), varchar(255), integer
>returns integer by value
>entry_point 'YDA_StrNPos' module_name 'ydafbudf';
>
>select yda_strnpos('abc', '12abc34a5abc678ab', 2) from rdb$database;
>returns 0 (should be 10). It turns out that AOccurrenceNo is received
>correctly but ASubStr and AStr are not.
2. declare the strings not as varchar but as the special interface
type cstring.
./heLen