libpng calls

Previous topic - Next topic

Synthetic

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?
"Impossible is a word people use to make themselves feel better when they quit."

My AMXMODX plugins for Day of Defeat 1.3 can be found here.

Schranz0r

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
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Synthetic

LOL As always, something painfully obvious that slipped by me. Thanks for the help! :D
"Impossible is a word people use to make themselves feel better when they quit."

My AMXMODX plugins for Day of Defeat 1.3 can be found here.