LibPNG Error
category: code [glöplog]
OK, so.
In porting some projects from GCC to MSVC, I needed to get new LibPNG and ZLib binaries. Now my png loading code doesn't work, and it seems to crash on this line:
with a memory access violation error. WTF?
In porting some projects from GCC to MSVC, I needed to get new LibPNG and ZLib binaries. Now my png loading code doesn't work, and it seems to crash on this line:
Code:
png_structp pngstruct = png_create_read_struct(PNG_LIBPNG_VER_STRING,NULL,NULL,NULL);
with a memory access violation error. WTF?
...in reading through the manual the entire routine should work...maybe I have inconsistent/bad binaries? Might someone have recent (1.4.0 or newer) compiled binaries for Win32?
Thanks.
Thanks.
I'm using libpng with version 1.2.36 and zlib (ver 1.2.3) - not the latest, I admit. I'm compiling the library by myself and statically linking it to the dll project. I'm not getting any problems at all, especially at the line you mentioned. But, as far as I get it, you're using a precompiled dll, right? Perhaps the precompiled library uses different runtime library than your project?
That's kindof what I'm thinking, though I compiled the lib's myself too. I suppose that's what I get for using beta.
Mind just uploading your .dll/.lib files for me?
Mind just uploading your .dll/.lib files for me?
As I said, i'm statically linking the manually compiled library's sources to my project - so it's a .lib in the end, not a .dll. Sure, I can put the file up on the net in the evening, as I'm not home at the moment, hence have no access to my binaries. Maybe someone else can help earlier.
you compiled it yourself... well, the obvious solution then is to compile a debug version and step into 'png_reate_struct()' to see what goes wrong... should be fairly easy.
btw: i'm using libpng myself (self compiled also), version is 1.4.3, and my call to png_create_read_struct looks exactly like yours
it might sound dismissive but my libpng issues are usually solved by Rebuild All
I'd just use stb_image and remove all reference to libpng and zlib
http://nothings.org/stb_image.c
http://nothings.org/stb_image.c
watch if there is a conf.h or config.h ... it generally declares processor words for each platforms.
nice lib...
how about looking at the actually dissassembly and see where it crashes and why?
Thanks for the quick (and somewhat condescending) replies, but I want a simple solution, and if others have successfully built the lib for VC++ I'd rather just use that. I'm looking for quick solutions. This issue isn't worth fixing if others have done it before, because I've fixed similar enough issues and don't need the experience.
Sorry, probably sound like a total douche now, but I'd rather focus on other issues if this has already been solved by somebody else.
Sorry, probably sound like a total douche now, but I'd rather focus on other issues if this has already been solved by somebody else.
Erm, how is "have you looked at it in the debugger?" condescending? Condescending is more like "you're doing it wrong, moron". See the difference?
If you want a simple solution, just go with stb_image. That's far more likely to give you what you want quickly than libpng with its notoriously overdesigned and overcomplicated interface is.
If you want a simple solution, just go with stb_image. That's far more likely to give you what you want quickly than libpng with its notoriously overdesigned and overcomplicated interface is.
Quote:
Erm, how is "have you looked at it in the debugger?" condescending? Condescending is more like "you're doing it wrong, moron". See the difference?
Sorry, my bad, I'm a bit edgy lately because of stress etc....sorry.
Thanks for the solutions! I think I'll go with stb_image.