[Gambas-devel] Gambas component queries
Rob
sourceforge-raindog2 at ...19...
Tue Jan 18 06:58:21 CET 2005
On Monday 17 January 2005 23:41, Srikanta Prasanna wrote:
> (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 ?
Init is called when the component is instantiated (most likely
with "DIM x = NEW AwesomeWidget".) Exit is called when the
component is destroyed, either because it passes out of scope
(at least I think it happens then) or because the program ends.
In Exit you have to free any memory you've allocated (whether
using Gambas' built in tools for managing memory, or the usual
malloc/free stuff, or some other toolkit's equivalent to
malloc/free), or you'll get the "N allocations not freed" thing
when gbx exits.
> 2) The GB refernce:
> Is this mandatory for every component?
> If yes, what is the actual use of it in ones component?
I'm not sure what you mean, but I was able to just use
GB.ReturnInteger, etc. without declaring anything special (I
just copied the old sdl component over to a new directory and
moved all the sdl stuff.... with all the recent changes to the
sdl component you may want to start from a smaller one, like my
own pcre one.)
> 3) Interpreter Hooks:
> Why are interpreter hooks necessary ?
They're not, or at least I don't think I used any in pcre or
posix.
> Can we have a component without any hooks to intrepreter ?
Definitely, as far as I know.
> When are these hooks called by the intrepreter ?
> Would the ImageMagick component need any of those ?
I don't know the answers to these questions.
> And finally, what are event-loops ?
An event loop is the main loop of any interactive program (and
many non-interactive programs). It is the loop in which the
program waits for input from a variety of sources (mouse clicks,
key presses, network activity, etc.), processes them, and then
goes back to waiting. Toolkits that can generate events from
user input generally have their own event loop, and you can only
use one such toolkit in a given program, which is why the Gtk
and Qt components in Gambas can't be used at the same time.
Thanks for taking a stab at ImageMagick, and I hope I can provide
whatever help you need since you will be making my life a lot
easier ;)
Rob
More information about the Devel
mailing list