Hello devs.

Please explain why the next example does not compiles with a message: "Error: Wrong type "Array Of Const" in array constructor"?

program Project1;

{$mode delphi}{$H+}

function g_object_dosomething(AObject: Pointer; args: array of const): Boolean; cdecl; external 'test.dll';

type
  TGObject = object
     function DoSomething(args: array of const): Boolean; stdcall;
  end;

function TGObject.DoSomething(args: array of const): Boolean; stdcall;
begin
  g_object_dosomething(@self, args);
end;

begin
end.

If I change "cdecl" to "stdcall" in g_object_dosomething then it compiles with no error.

For me it is strange. Should developer care about internal compiler representation of an "array of const" for different conventions? Imo this is a compiler task.

I've checked the same on delphi XE and there it compiles.

So whether this is 1)a bug 2)unimplemented feature 3)desired compiler behavior?

Best regards,
Paul Ishenin.

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to