I agree that the prototypes should be fixed. Actually, it's not that bad, just 21 instead of 6 prototypes, if I'm not mistaken: https://github.com/pure-data/pure-data/pull/688#discussion_r684245557

On 06.08.2021 13:26, Claude Heiland-Allen wrote:
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




_______________________________________________
Pd-dev mailing list
[email protected]
https://lists.puredata.info/listinfo/pd-dev

Reply via email to