Web lists-archives.com

Re: [Mingw-users] Using mingw's libpng?

On 06-Jul-2016 07:46, Eli Zaretskii wrote:

> Are you saying that a FILE * pointer is being created in a DLL, and
> then being used outside of that DLL?  That is a no-no on MS-Windows
> (and also on other platforms), so that could definitely be part of the
> problem.

Apparently.  The setup.py for the application builds something called 
on Windows which I had taken to be some sort of a Python launched 
executable but now that I look carefully at the several thousand 
character long command line which builds it, "-mdll" appears, so it is 
indeed a DLL.   The code in this tells libpng where to write the file in 
the usual manner:

          FILE *fp = fopen("filename","wb");
          png_init_io(png_ptr, fp);

In this build environment that doesn't work.

> Yes, something like that.  The important thing is: the file pointers
> should be used in the same library/program as the one that creates
> them.  They cannot be passed across DLLs.

Which does make one wonder how this code ever works on any platform, or 
why libpng does not come with a


to avoid this problem.  On linux setup.py builds the expected _cmd.so, 
also a shared library, and it uses exactly the same code, and this 
section of code works without a hiccup there.


David Mathog
Manager, Sequence Analysis Facility, Biology Division, Caltech

Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
MinGW-users mailing list

This list observes the Etiquette found at 
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

You may change your MinGW Account Options or unsubscribe at:
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe