GLBasic forum

Main forum => GLBasic - en => Topic started by: Synthetic on 2009-Sep-16

Title: libpng calls
Post by: Synthetic on 2009-Sep-16
I need to directly access the libpng functions so I can manually write PNG images via inline. I've added ones for OpenGL without a problem but I'm getting problems with libpng. For example the function png_create_write_struct takes 4 arguments but I'm getting this error output:

Code (glbasic) Select
C:\DOCUME~1\SYNTHE~1.SYN\LOCALS~1\Temp\glbasic\gpc_tempa.cpp: In function `DGInt __GLBASIC__::png_create_write_struct()':
C:\DOCUME~1\SYNTHE~1.SYN\LOCALS~1\Temp\glbasic\gpc_tempa.cpp:95: error: too many arguments to function `DGInt __GLBASIC__::png_create_write_struct()'
C:\DOCUME~1\SYNTHE~1.SYN\LOCALS~1\Temp\glbasic\gpc_tempa.cpp:99: error: at this point in file


This is the code I have so far:

Code (glbasic) Select
INLINE
}
#define PNG_LIBPNG_VER_STRING "1.2.6"
extern "C"
{
void __stdcall png_create_write_struct(char,int,int,int);
}
namespace __GLBASIC__
{

ENDINLINE

FUNCTION png_create_write_struct:
        LOCAL ptr
INLINE
ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,0,0,0);
ENDINLINE
        return ptr
ENDFUNCTION


I've downloaded version 1.2.6 of libpng and looked to make sure the function takes 4 args which it does so I don't get why it's saying too many arguments to function. Is it possible that the libpng library GLBasic uses is customized?
Title: Re: libpng calls
Post by: Schranz0r on 2009-Sep-16
The GLB-Function "png_create_write_struct" have no arguments  :whistle: ,  you call it recursive!

OLD:

Code (glbasic) Select
FUNCTION png_create_write_struct:
        LOCAL ptr
INLINE
ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,0,0,0);
ENDINLINE
        return ptr
ENDFUNCTION


new:

Code (glbasic) Select
FUNCTION Wrapp_png_create_write_struct:
        LOCAL ptr
INLINE
ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,0,0,0);
ENDINLINE
        return ptr
ENDFUNCTION
Title: Re: libpng calls
Post by: Synthetic on 2009-Sep-17
LOL As always, something painfully obvious that slipped by me. Thanks for the help! :D