Ovilia
Ovilia

Reputation: 7300

libpng error under VC6.0

I'm using libpng in my OpenGL project to load texture of png file with VC6.0 under windows xp. It's OK to build and error occurs during running. The error is

the instruction at 0x0040b4a3 referenced memory at 0x00000008 the memory could not be written

I've tried to reboot but error remains. And I've put the exe file to another xp desktop and error remains.

When debugging, I found this statement went wrong: (which is usually used with libpng)

png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_STRIP_16 | PNG_TRANSFORM_PACKING | PNG_TRANSFORM_EXPAND, png_voidp_NULL);

Error message is

Unhandled exception in test.exe(NTDLL.DLL): 0xc0000005: Access Violation.

My code works fine with g++ under fedora, but something is wrong under VC6.0 with windows XP.


Source code is very large and I don't know what goes wrong, so I don't know what code to paste here.
Does any one has any idea about this?
I'll be very grateful if you can help me on this. Thx! :)

Upvotes: 0

Views: 326

Answers (1)

Mario
Mario

Reputation: 36517

Did you check the pointers passed into the function? One of them might have the value 8 instead of some valid memory address. If the data passed into libpng is fine, the error might be somewhere else.

Minor side note: Any reason for using VC++ 6.0 over any of the newer (and free) Express Editions?

Upvotes: 1

Related Questions