diff options
author | bobsayshilol <bobsayshilol@live.co.uk> | 2019-07-28 20:42:04 +0300 |
---|---|---|
committer | bobsayshilol <bobsayshilol@live.co.uk> | 2019-07-28 21:26:59 +0300 |
commit | 0326898e9081e6d92fa8a752df768c1452f0bcb0 (patch) | |
tree | edfc8f84a46d5b5abf82087d491d7f28b157fef3 /lodepng.h | |
parent | f6155a4206046a31a9532d70caf517845af64c83 (diff) |
Fix ABI incompatibility when calling a C++ compiled lodepng.cpp from C code or vice versa.
The addition of a virtual destructor to LodePNGState when compiled as
C++ causes a vptr to be added at the start of the struct. This results
in the members of the struct changing their offset depending on whether
they're seen from C or C++ code. Internally the LodePNGState struct is
never deleted (as to invoke the virtual destructor) and has no virtual
methods called on it so it doesn't need to be virtual. Hence fix the
ABI incompatibility by removing the virtual destructor.
Diffstat (limited to 'lodepng.h')
-rw-r--r-- | lodepng.h | 4 |
1 files changed, 0 insertions, 4 deletions
@@ -743,10 +743,6 @@ typedef struct LodePNGState { LodePNGColorMode info_raw; /*specifies the format in which you would like to get the raw pixel buffer*/ LodePNGInfo info_png; /*info of the PNG image obtained after decoding*/ unsigned error; -#ifdef LODEPNG_COMPILE_CPP - /* For the lodepng::State subclass. */ - virtual ~LodePNGState(){} -#endif } LodePNGState; /*init, cleanup and copy functions to use with this struct*/ |