[fpc-pascal] Problem with varargs directive

silvioprog silvioprog at gmail.com
Mon Jan 11 19:56:18 CET 2016


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:

http://docwiki.embarcadero.com/RADStudio/XE8/en/E2591_Only_cdecl_functions_may_use_varargs_(Delphi)

http://docwiki.embarcadero.com/RADStudio/XE8/en/E2277_Only_external_cdecl_functions_may_use_varargs_(Delphi)

So it seems that I can't use `varargs` loading libraries dynamically on
Delphi. :-(

function FmtStr(const fmt: PAnsiChar): PAnsiChar; varargs; cdecl; external
> yourlibname;
>

I need to use it in variables because I wanna load my library dynamically.
:-/

Note: varargs comes before cdecl, though I am not sure if it matters.
>

It seems irrelevant, but I saw it in some Delphi units declaring it as `...
cdecl; varargs; ...`.

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


More information about the fpc-pascal mailing list