[Gambas-devel] Gambas component queries

Benoit Minisini gambas at ...1...
Tue Jan 18 11:38:21 CET 2005


On Tuesday 18 January 2005 05:41, Srikanta Prasanna wrote:
> Hi All,
> In order to attempt writing of a ImageMagick component
> (thanks rob!) for Gambas, I was trying to understand
> the steps involved in adding a component to Gambas.
>
> Below is a given my (still-very-basic) understanding
> of how things work, and why it is necessary, for
> Gambas and its component; also there are queries
> about some areas which I did not understand. Please
> correct me if you find my understanding to be wrong.
>
> 1) My component must contain a main.cpp (as the code
> will be in cpp) and a main.h.
> This main.cpp should implement a init and exit functions
> which will be invoked by the interpreter at the startup
> and cleanup of my component.
> (Query) Is the init of all the components in a project
> invoked when the project is executed? Or is it invoked
> only when it is necessary (somewhat like 'Just-In-Time') ?
> Similary, when is exit called ?

GB_INIT() is called as soon as possible, i.e. when the component shared 
library is loaded.

GB_EXIT() is called as late as possible, i.e. when the component shared 
library is unloaded.

>
> 2) The GB refernce:
> Is this mandatory for every component?

Yes.

> If yes, what is the actual use of it in ones component?
>

It is the way you communicate with the interpreter.

> 3) Interpreter Hooks:
> Why are interpreter hooks necessary ?

Hooks are functions called by the interpreter at specific moments.

> Can we have a component without any hooks to intrepreter ?

Yes.

> When are these hooks called by the intrepreter ?

This is explained in the wiki documentation.

> Would the ImageMagick component need any of those ?
>

I don't know. I don't think so.

> And finally, what are event-loops ?

It is the way the interpreter deals with inputs: a loop that get events one by 
one and process them.

The interpreter has itw own event loop, but, for example, it is replaced by 
the QT one when you use the gb.qt component.

>
> Thanks!!

I suggest you read carefully the wiki documentation about components.

Regards,

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




More information about the Devel mailing list