Well I got it to build pretty easily. but it didn’t work as a dll for me AT ALL.
First I tried the easy way and got the prebuilt binaries. But I kept getting this error:
Unhandled exception at 0x7d64d233 in Using_libpng.exe: 0xC0000005: Access violation writing location 0×00000014.
which is discussed here (but no answer is found.. he just ends up saying “it works for me!”) and an apparent answer is given here
The answer (from the second thread posting) that I believe it to be a correct synopsis of the root cause was:
So you pass the FILE* from fopen to png_init_io which will cause libpng
itself to make fread() calls on that FILE*. If libpng then crashes in
png_read_info it means that the library you used to allocate the FILE* (i.e.
the one containing the implementation of fopen which was called in (1)) is
*not* the same as the library libpng expects to call to read from the FILE*
(i.e. the library libpng.so was compiled/linked against to get the
implementation of fread).FIX:
If you can”t change your library to match libpng and you don”t want to
compile and build libpng (statically) to change it then you have no choice
but to implement your own file IO and hope that there are no other issues (I
believe that file IO with stdio is the *only* case where an object is
allocated in the application and subject to library calls within libpng.)
basically he’s saying that libpng was built using a “different version” of file reading capability than what you have on your machine.
Probably true because i’m running the accursed x64 edition of winxp pro.
so i set out to compile my own libpng
Finally got it into a
visual studio 2008 project file
(which you can download! see I am nice!), this may help you if you can’t get it to work still.
So I built it as a big hunking .lib file (800k!) and it works now. So fuck it, I don’t care how big it is, it works, and I don’t have to worry about dll’s.
This is a nice library now, once I can get it to build.
Treating windows developers badly is not cool, btw, png team.
9 Comments
thanks for good solution to this nasty problem
you are my hero
good one dude.. :)
Awesome, this helped a lot.
I was trying to build something using libpng for windows and I downloaded your visual studio project and it worked. Thanks a lot dude
this helps me! Thanks a lot.
thanks this fixed me issue!
You’re GOD!
your account for the download has been suspended *cries*
I’ve got the exact same problem, if you cant put up a downloadable file that will compile the libpng files for me, then could you give me a rough guide on how to do it myself? I’m running Vis stud 2010 :)
Please help! I’ve only got a month to finish this project, and don’t really have time to remake it all on a linux enviroment :/
Hope you can get back to me!
planty182