pouët.net

Go to bottom

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:

Code:png_structp pngstruct = png_create_read_struct(PNG_LIBPNG_VER_STRING,NULL,NULL,NULL);

with a memory access violation error. WTF?
added on the 2010-08-13 08:05:28 by ferris ferris
...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.
added on the 2010-08-13 08:06:28 by ferris ferris
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?
added on the 2010-08-13 08:37:45 by kbi kbi
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?
added on the 2010-08-13 09:07:29 by ferris ferris
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.
added on the 2010-08-13 09:15:28 by kbi kbi
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.
added on the 2010-08-13 09:19:02 by hcdlt hcdlt
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
added on the 2010-08-13 09:21:41 by hcdlt hcdlt
it might sound dismissive but my libpng issues are usually solved by Rebuild All
added on the 2010-08-13 11:21:09 by Gargaj Gargaj
I'd just use stb_image and remove all reference to libpng and zlib

http://nothings.org/stb_image.c
added on the 2010-08-13 11:31:00 by _-_-__ _-_-__
watch if there is a conf.h or config.h ... it generally declares processor words for each platforms.
added on the 2010-08-13 15:24:05 by krabob krabob
nice lib...
added on the 2010-08-14 21:14:21 by rmeht rmeht
how about looking at the actually dissassembly and see where it crashes and why?
added on the 2010-08-14 21:31:15 by emoon emoon
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.
added on the 2010-08-15 07:37:55 by ferris ferris
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.
added on the 2010-08-15 10:17:08 by ryg ryg
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.
added on the 2010-08-15 11:08:49 by ferris ferris

login

Go to top