[Gambas-devel] gb.api

Benoit Minisini gambas at ...1...
Mon Apr 25 14:30:37 CEST 2005


On Friday 22 April 2005 10:52, Daniel Campos wrote:
> I've placed gb.api and the two examples here:
>
> http://gambas.gnulinex.org/api/
>
> As it seems it is impossible to download the files from Gambas forge...
>
> Regards,
>
> D. Campos
>
>

Hi, Daniel.

Good job, but you should have tell before that you were working on that. 
Because I'm currently adding this feature directly inside the interpreter.

Declaring a method would be something like that:

[PUBLIC] EXTERN Func(Param1 AS Type1, Param2 AS Type2, ...) As ReturnType IN 
"Library" WITH "C function prototype"

This is equivalent to your Api.Register method. The C function prototype is a 
string that will be transformed by the compiler into a static description of 
the C function.

The function will be called like a normal function.

This is equivalent to your ApiCall.* method.

I wanted to add a "Struct" class to manage C structure in memory, but with 
special syntax support from the compiler.

This is equivalent to your ApiPointer class I think.

I'm not sure that your implementation of ApiCall._unknown is very portable... 
I think it works on i386, 32 bits ;-) Well, like Gambas one could say ;-)

I'm not sure the way you call functions work everywhere. Is is sure that 
passing a structure by value is equivalent to pass the arguments one by one ? 
That the order of arguments will be preserved on another architecture ?

Maybe I should add the same memory & string utility functions you added to the 
component.

Support for callbacks may be interesting too...

What do you think about that ?

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the Devel mailing list