Re: Can GTK run without a C main function?
- From: Michael Torrie <torriem gmail com>
- To: "gtk-list gnome org >> Gnome List" <gtk-list gnome org>
- Subject: Re: Can GTK run without a C main function?
- Date: Sat, 24 Mar 2012 16:31:11 -0600
On 03/23/2012 10:23 AM, Patrick wrote:
> Hi Everyone
>
> Please forgive this strange post, I am not a professional programmer but
> I am trying something a bit difficult.
>
> I like Lua but I have fallen in love with Ada now.
Looking at Ada Lovelace's wikipedia page, she is portrayed as a fairly
attractive woman, so I don't blame you. :)
> Lua's library support
> is not great but the language really shines when used with C libraries.
> I would like to use Ada in a similar way and ignore all the Ada
> libraries, including the GTK binding.
>
> I am presently trying to compile a mixed c ada application. The program
> calls C GTK in a non main c function. The main function is on the Ada side.
>
> Is this permissible? Does GTK depend on a C entry point?
So far as I know, gtk wants to be initialized with gtk_init(). Then you
have to start up the GTK main loop with gtk_main(). You can do this
from anywhere, not just main. Unfortunately, calling gtk_main does not
return until a call to gtk_quit(). So you could say that gtk_main is
the C entry point.
If you are okay with GTK being in control, and calling back into your
ada functions, then it should work fine. And really in event-driven
programming, you react to events anyway. You don't program procedurally.
If you have an Ada loop you have to run, either to poll something or to
do a long-running calculation or process, you could do it in another
thread I, and call g_idle_add to do things in the main GTK GUI thread.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]