[fpc-pascal] Error: Can't declare procedure as EXTERNAL
Michael.VanCanneyt at Wisa.be
Michael.VanCanneyt at Wisa.be
Thu Dec 2 21:37:33 CET 2004
On Thu, 2 Dec 2004, Den Jean wrote:
> Hi,
>
> the new FPC CVS release of 29/11 forbids
> delphi / kylix type of library use
>
> eg
>
> --------------------------------------------------------------------------------------------------------------
> interface
>
> function QObjectList_create: QObjectListH; cdecl; overload;
> function QObjectList_create(list: QObjectListH): QObjectListH; cdecl; overload;
>
> implementation
>
> function QObjectList_create(list: QObjectListH): QObjectListH; cdecl; external QtShareName name QtNamePrefix + 'QObjectList_create2';
> function QObjectList_create: QObjectListH; cdecl; external QtShareName name QtNamePrefix + 'QObjectList_create';
> --------------------------------------------------------------------------------------------------------------
>
> is forbidden now and generates a "Error: Can't declare procedure as EXTERNAL" when compiling.
This is correct.
>
> Apparently the external directive has to be moved to the INTERFACE section.
> I do not know why this has changed (perhaps a very good reason),
> but to me it seems not so good:
>
> 1) This is not Delphi/Kylix compatible (just try to compile Qt.pas)
This is known, but is unfortunately unavoidable. Delphi/Kylix uses an
internal linker and can therefore solve this problem. FPC has to use an
external linker, and therefore the assembler label must be fixed already in
the interface section. (it has to do with the case when 2 units are using
each other)
>
> 2) This breaks a lot of existing code, especially bindings ( I will need to move 3283 external directives in my qte binding)
This is known, but can't be helped.
>
> And most importantly:
> 3) This way the interface gets cluttered with implementation details like "name QtNamePrefix + 'QObjectList_create2'"
Once more, this is known, but cannot yet be solved. Only when FPC has an
internal linker, this problem can be solved.
That it worked in the past is pure luck. (well, almost)
Michael.
More information about the fpc-pascal
mailing list