Quantcast

C component declaration

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

C component declaration

martin p cristia
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(.....?

Saludos Martin

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

_______________________________________________
Gambas-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: C component declaration

Tobias Boege-2
On Wed, 30 Dec 2015, Martin Cristia 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(.....?

This is the response I gave you at gambas-user:

On Wed, 30 Dec 2015, Tobias Boege wrote:

> 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.

I may add the following to specifically address your question:

  GB_METHOD("VertexPointer", NULL, your_function, "(Size)i(Type)i(Stride)i(Array)Object[];")

The actual types ("i" for Integer, "Object[]" for an array of generic
objects) may vary -- I don't know how OpenGL types translate to Gambas ones
and guessed the values above. Your method may or may not need to be static.

You may also want to read the article linked here[0] on native component
development for Gambas.

Regards,
Tobi

[0] http://www-e.uni-magdeburg.de/tboege/gambas/

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

------------------------------------------------------------------------------
_______________________________________________
Gambas-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: C component declaration

Benoît Minisini
In reply to this post by martin p cristia
Le 30/12/2015 17:08, Martin Cristia a écrit :

> 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(.....?
>
> Saludos Martin
>

Please give details about glVertexPointer() : what it does, and what
exactly is the array argument, as GLvoid * can points at anything.

Regards,

--
Benoît Minisini

------------------------------------------------------------------------------
_______________________________________________
Gambas-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-devel
Loading...