[fpc-devel] who can explain why array of const can't be passed to another array of const
Paul Ishenin
ip at kmiac.ru
Wed Sep 14 04:15:51 CEST 2011
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.
More information about the fpc-devel
mailing list