2012/11/11 Sven Barth <pascaldra...@googlemail.com>: > Yes and this is exactly what the change states. You can not write "varargs" > functions in Pascal that can be accessed from C.
Wouldn't it be possible to write a function in pascal that declares a simple longint parameter instead of the varargs and then inside the function use the stack pointer (the address of that argument) to read the entire list from the stack directly? Since in cdecl the caller will clean up the stack after the function call this should not cause any problems? something along these lines (for example if a list of longints should be passed): procedure FakeVararg(dummy: LongInt); var Start: PLongInt; First, Second, Third: LongInt; begin Start := PLongInt(@dummy); First := Start[0]; Second := Start[1]; Third := Start[2]; end; (or something very similar to this, not sure if the above code works already, not tested) _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal