www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - libpng dll functions weird behaviour

I am getting really strange results using libpng dll functions. Values 
retrieved from function calls by return, seems to be random garbage. But 
retrieving values by pointer (function arguments) works ok.

tested setups:
1. libpng13.dll/libpng13.lib v1.2.16
built on my machine with visualstudio2005. lib converted with 

2.libpng13.dll/libpng13.lib v1.2.8
Precompiled. From gnuwin32.sourceforge.net. lib converted with 

Here is minimal test case:
pngtest.d - http://paste.dprogramming.com/dpf5eoyg.php
libpng/api.d - http://paste.dprogramming.com/dpi42vqv.php

Tested with dmd v1.006, and v0.175 (for sake of experiment).

Any help would be really appreciated, I'm about to pull my hairs out =(

Feb 18 2007