[fpc-pascal] Problem with varargs directive

silvioprog silvioprog at gmail.com
Mon Jan 11 20:18:23 CET 2016

On Mon, Jan 11, 2016 at 3:56 PM, silvioprog <silvioprog at gmail.com> wrote:

> On Mon, Jan 11, 2016 at 3:41 PM, Anthony Walter <sysrpl at gmail.com> wrote:
>> I believe in Delphi only external functions may use varargs. In your case
>> you are declaring a variable, which could be assigned to a local function.
> You are right:

Fixed. I just removed the first `;`:

=== begin code ===
  FmtStr: function(const fmt: PAnsiChar): PAnsiChar; cdecl varargs;
=== end code ===

Now it compiles fine in an original copy of Delphi Seattle and in the FPC
from trunk (3.1.1).

I'm glad to compile that, but it is very strange, according EMB docs:

"The varargs directive works only with external routines and only with the
cdecl calling convention.":


But I saw many programmers using it in funcs declared as variable:


So I'm going to use it too hehe! :-)

Silvio Cl├ęcio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160111/49892415/attachment.html>

More information about the fpc-pascal mailing list