[Gambas-user] Declaration and use of external functions contained in a Structure

Ru Vuott vuott at ...325...
Mon Apr 21 04:17:32 CEST 2014


Hello,

I'm transporting a C code in Gambas that provides some functions of "Libvo-aacenc" API.
The peculiar thing is that a "header" file of "Libvo-aacenc" provides functions "contained in a Structure" !

Here the declaration in "voAudio.h":

typedef struct VO_AUDIO_CODECAPI
{

VO_U32 (VO_API * Init) (VO_HANDLE * phCodec, VO_AUDIO_CODINGTYPE vType, VO_CODEC_INIT_USERDATA * pUserData );

VO_U32 (VO_API * SetParam) (VO_HANDLE hCodec, VO_S32 uParamID, VO_PTR pData);

...and so on....

}


----------------------------------------------------------------


In the C code those functions are used as follows:

**********
int main(int argc, char *argv[]) {

...
VO_AUDIO_CODECAPI codec_api = { 0 };
...
...
...

codec_api.Init(&handle, VO_AUDIO_CodingAAC, &user_data);

codec_api.SetParam(handle, VO_PID_AAC_ENCPARAM, &params)

....
....
...etc...

}
*************


How should I declare in Gambas those external functions contained in the structure?  ...as Pointer ? But "where" ? In a Structure ? EXTERN will not be used ?

And then "how" do I use those functions in Gambas code ? 


Best regards
vuott




More information about the User mailing list