[Gambas-user] C component declaration

Tobias Boege taboege at ...626...
Wed Dec 30 00:01:50 CET 2015


On Tue, 29 Dec 2015, tercoide wrote:
> How to declare arrays when making a component, ie :
> C declaration in library
> void glVertexPointer(GLint size, GLenum type, GLsize stride, const GLvoid*array)
> 
> C gb component
> 
> GB_STATIC_METHOD( ......??
> 
> DECLARE_METHOD(.....?
> 

I'll tell you how I answer such questions for myself when I forgot the
details: think hard if any Gambas component has any class with a method
that returns an array object. If you're lucky there is such a component
which is written in C. Then look into its source code how it's done.

In this case I remembered that gb.net.curl's HttpClient can return a
String[] of headers. You go to gb.net.curl/src/CHttpClient.c and find:

  GB_PROPERTY_READ("Headers", "String[]", HttpClient_Headers),

that is you treat array types like every other class by writing the full
class name into the signature. Only the primitive data types have
abbreviations.

Also you should subscribe to gambas-devel and ask C development questions
there. The gambas-user list is for... users, not developers.

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk




More information about the User mailing list