[vlc-devel] Callbacks in modules written in C++ have wrong linkage
remi at remlab.net
Mon Feb 22 20:39:31 CET 2016
Le 2016-02-22 14:37, Filip Roséen a écrit :
>> Related to this problem is the fact that loading of modules stores
>> pointer-to-functions inside pointer-to-void, which is
>> undefined-behavior according to both the C and C++ Standard.
Yes and no. ISO C leaves it as a portability issue what conversion what
function and void pointers do, but somewhat recommends supporting it for
debugging purpose anyway (J.5.7). POSIX makes it well defined so we do
Win32 & OpenGL use a different style:
void (*)() instead of void *.
I think that is more dangerous, as it allows accidental function calls
without proper cast. Such a function call would fail on LP64 and LLP64
platforms due to default promotion rules.
More information about the vlc-devel