[Gambas-devel] Some questions about Gambas C interface
Benoit Minisini
gambas at ...1...
Tue Oct 12 15:58:01 CEST 2004
On Tuesday 12 October 2004 13:57, Daniel Campos wrote:
> Hi Benoît:
>
>
> I have some questions about Gambas C interface:
>
> I'm using GB.Push, GB.Call and GB.GetFunction in order to call the
> 'Post' function of HttpClient from RPC Client. All seems to be ok with
> this code:
>
> GB.GetFunction (&Post,THIS->http,"Post",NULL );
> GB.Push(2,GB_T_STRING,"text/xml",8,GB_T_STRING,buffer->content,buffer-
>
> >use);
>
> GB.Call (&Post,2,1);
>
> Where "Post" is a GB_FUNCTION, and THIS->http is an HttpClient pointer.
>
> However:
>
> What's the meaning of the "signature" parameter from GB.GetFuncion? I
> just used NULL.
With this paramter, you can specify a function signature that the function you
are looking for must match. This signature is a string with the same syntax
as in a GB_DESC description structure.
>
> How can I call to a property instead of a method?
>
You don't have an interface for doing that in GB_INTERFACE. But this is
possible - look the object_set_property and object_get_property methods in
'gbx_c_class.c'.
> How can I receive the return value after calling GB.Call?
Same answer. Actually, after calling GB.Call(), the return value is stored in
the same place as if you called a GB.Return*() method.
>
> After I do GB.Push must I free anything, or Gambas does it
> automatically?
Gambas does it automatically.
>
> Well, that's all for today...:-))
>
The GB.Call() API was created for allowing calling static functions, when you
don't have an object and an event under the hand.
I think you must create an interface in the gb.curl component with an access
to all C functions you need in gb.xml.libxml.rpc.
Or when I allow making components directly in Gambas, you will make the RPC
component this way :-) Maybe this is the better solution.
Here is a link to a pre-version of 1.0RC1 so that you can take the libxml
directory. I modified the configure.in file, so that libraries and includes
are searched, and I modified your Makefile.am, to use the Makefile variables
generated by configure.in, and to fix a typo error on a file name.
Look at them to understand how things work!
http://gambas.sf.net/gambas-0.99.RC1.tar.bz2
> Regards,
>
> Daniel Campos
>
>
Regards,
--
Benoit Minisini
mailto:gambas at ...1...
More information about the Devel
mailing list