Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2002-07

How to give an array-of-const to a C ellipse?

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mattias Gaertner

Hi all,

I have found a problem with 'array of const'. There are two types: The array of variant records and the C-Compiler array used by the 'cdecl;external;'. The compiler allows to put the former into the latter, but it does not convert it correctly. See the program below.

Is there a workaround?

program printftest;
{$mode objfpc}{$H+}
procedure printf(fm: pchar; args: array of const); cdecl; external 'c';
procedure print(i: integer; fm: pchar; args: array of const);
begin
  printf(fm,args);
end;
begin
  print(0,'a number %i '#13#10,[3333]);
end.

Mattias