The library has been modified to better hide internal structures. So what you need to do is:
typedef jmp_buf* (*png_set_longjmp_fnPtr)(png_structp png_ptr, png_longjmp_ptr longjmp_fn, size_t jmp_buf_size); png_set_longjmp_fnPtr mypng_set_longjmp_fnPtr = 0;
Then, when you dynamically execute LoadLibrary, do the following:
mypng_set_longjmp_fnPtr = (png_set_longjmp_fnPtr) GetProcAddress(hpngdll, "png_set_longjmp_fn"); extern "C" { jmp_buf* png_set_longjmp_fn(png_structp png_ptr, png_longjmp_ptr longjmp_fn, size_t jmp_buf_size) { if (mypng_set_longjmp_fnPtr) { return (*mypng_set_longjmp_fnPtr)(png_ptr, longjmp_fn, jmp_buf_size); } return 0; } }
The following code, which calls an unresolved external, will now work fine:
if (setjmp(png_jmpbuf(png_ptr))) {
I posted it here since I could not find another place. I was looking for a problem and found that other people are facing the same problem, but without a solution, so they again switched to an earlier version of libpng. So I thought I'd post it here.
Kharina Tigerfish
source share