From: Roadkill <roa...@gr...> - 2005-07-20 21:20:31
|
Bob Friesenhahn wrote: > On Wed, 20 Jul 2005, Olivier Dionne wrote: > >> I am having the same "access violation" error message. I compiled >> with VC++ >> 2003, MSoftXP, libpng 1.2.8 and zlib 1.2.2. Also, I added try catches >> around the read code. The method png_read_info() seems to be the one >> giving >> out this violation. > > > Libpng won't be throwing any C++ exceptions since it is written in C. > I don't know that it is safe for C++ code called from C code to throw > exceptions either so it would not be wise to throw a C++ exception > from an error callback function. > > If what Tyler says is indeed the case, then it may be best to have the > bit of code which interfaces with libpng be C code rather than C++. > "*setjmp* and *longjmp* do not support C++ object semantics. In C++ programs, use the C++ exception-handling mechanism." http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_crt_setjmp.asp Before I switched to try-catch the setjmp wasn't actually reporting an error when it jumped back. But the stack was being corrupted, so after a few operations the values in some of the variables changed unexpectedly. Perhaps it is just working now because I'm not using png_jmpbuf. Your probably right Bob, some sort of interface is needed. > As far as the access violation goes, it sounds like a bad pointer is > being used. The debugger should be a good tool to help identify the > cause of the problem. Glenn, try using your own file io routines. I could never get the libpng ones to work. I use the callbacks and do my own file io instead. Tyler -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.323 / Virus Database: 267.9.2/52 - Release Date: 19/07/2005 |