[PD-dev] Passing creation arguments to newmethod
Claude Heiland-Allen
claude at mathr.co.uk
Fri Aug 6 13:26:22 CEST 2021
Hi,
On 05/08/2021 22:32, Christof Ressi wrote:
> Fun fact: pd_typedmess() often calls function pointers with more
> arguments than the original functions - which is undefined behavior.
> It just happens to work because in the default calling convention
> ("cdecl") the caller cleans up the stack. With other calling
> conventions where the *callee* has to clean up the stack, e. g.
> "stdcall", this would lead to stack corruption and crash horribly :-)
I had to fix this in my patches to compile for web with Emscripten,
where function pointers must be called at their exact type (or the
Emscripten runtime stops hard).
https://github.com/pure-data/pure-data/pull/688
May need a little care and attention before merging, sorry I haven't
been more proactive on this one.
I think something similar might have been integrated into Purr-data already?
Claude
--
https://mathr.co.uk
More information about the Pd-dev
mailing list