Showing posts with label libpng. Show all posts
Showing posts with label libpng. Show all posts

Saturday, November 22, 2008

crashfixing

As I was working on digikam porting recently I made some first packages - and of course those were not even starting up. Well, to be a bit clearer: the packages build with msvc (Microsoft Visual Studio) crashed both in
png_read_info
for png images and in
jpeg_read_header
for libjpeg. This seemed to be rather odd I thought, as there seemed to be a lot of applications using these libraries for image i/o. But as I found out, most don't use our dll but instead a static version of it. That wasn't an option for me though.

To understand the crashes a bit more I found a good explanation here. Basically the problem is that msvc will link to different runtime environments (our libpng/libjpeg dll against msvcrt and our digikam binaries against msvcr80) and each of those runtimes has a different idea of what a FILE pointer is. When trying to actually do something with your FILE pointer, you will get the crash.

The solution to the png problem I found in a french forum, I did what they said and now it works (diff). The solution to the jpeg problem is a bit harder as it requires some rewrite/addition. You might have to replace my QByteArray with whatever you use to store the complete file content but essentially it is everywhere the same (changes): I got it from here.