[fpc-pascal] Documentation or compiler bug?

Michael Van Canneyt michael at freepascal.org
Sat Jul 8 09:12:14 CEST 2023

On Sat, 8 Jul 2023, Hairy Pixels via fpc-pascal wrote:

> I get the error "Procedure directive "CDECL" cannot be used with "EXTERNAL"" when I use "cdecl" with external modifiers yet the docs at https://www.freepascal.org/docs-html/ref/refsu73.html say":
> When compiling this, and linking to the C-library, the strlen function can be called throughout the program. The external directive tells the compiler that the function resides in an external object file or library with the “strlen” name (see 14.7).
> Suggesting they can be used together, so which is right? Compiler is: Free Pascal Compiler version 3.3.1 [2023/03/03] for aarch64

They are used together. The FPC sources are full of them, most import
libraries work like that:

function PQconnectStart(conninfo:Pchar):PPGconn;cdecl;external External_library name 'PQconnectStart';

It would be helpful if you would give the exact statement you are writing.


More information about the fpc-pascal mailing list