BASIC

Author Topic: libpng calls  (Read 1501 times)

Offline Synthetic

  • Mr. Drawsprite
  • **
  • Posts: 61
    • View Profile
    • ClanBam
libpng calls
« 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?
"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.

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 5013
  • O Rly?
    • View Profile
Re: libpng calls
« Reply #1 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
I <3 DGArray's :D

PC:
AMD RYzen 7 1700 @3.9Ghz, 16GB HyperX Fury 2666Mhz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

Offline Synthetic

  • Mr. Drawsprite
  • **
  • Posts: 61
    • View Profile
    • ClanBam
Re: libpng calls
« Reply #2 on: 2009-Sep-17 »
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.