Subject | Re: [firebird-support] Re: Linux UDF written in pascal |
---|---|
Author | Flávio Costa |
Post date | 2009-06-10T11:53:26Z |
library test;
{$mode DELPHI}{$H+}
{$PACKRECORDS C}
uses
SysUtils, DateUtils, Classes;
function is_cheque(s: PChar): integer; cdecl; export;
var
p: PChar;
begin
Result := 0;
if (strlen(s) = 0) or (strlen(s) > 6) then exit;
p := s;
while p^ <> #0 do
begin
if not (p^ in ['0'..'9']) then exit;
Inc(p);
end;
Result := 1;
end;
exports
is_cheque;
begin
end.
This UDF was compiled on both Linux and Windows, and it works.
{$mode DELPHI}{$H+}
{$PACKRECORDS C}
uses
SysUtils, DateUtils, Classes;
function is_cheque(s: PChar): integer; cdecl; export;
var
p: PChar;
begin
Result := 0;
if (strlen(s) = 0) or (strlen(s) > 6) then exit;
p := s;
while p^ <> #0 do
begin
if not (p^ in ['0'..'9']) then exit;
Inc(p);
end;
Result := 1;
end;
exports
is_cheque;
begin
end.
This UDF was compiled on both Linux and Windows, and it works.
On Wed, Jun 10, 2009 at 06:38, Coco Pascal<coco.pascal@...> wrote:
>
>
> Flávio Costa wrote:
>>
>>
>> I've successfully created a UDF in free pascal with compiler
>> directives I mentioned in another topic...
>>
>
> Could you please give more details? Object Pascal or Delphi mode allow
> different syntax but the generated executable is the same.
>