comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Ada Library, called, returns and continues ?
Date: Tue, 18 Dec 2012 16:37:46 +0100
Date: 2012-12-18T16:37:46+01:00	[thread overview]
Message-ID: <1e0o0otix7lpu$.sw1iytsyjxg2.dlg@40tude.net> (raw)
In-Reply-To: d7b03723-67ab-4b34-8639-d32c7967b44e@googlegroups.com

On Tue, 18 Dec 2012 07:00:41 -0800 (PST), Patrick wrote:

> To pick one at random:
> Cal : access Gtk_Calendar_Record'Class
> 
> Now I know this is a pointer to a C object but only because I basically get C/C++ now.

No it is a pointer to an Ada object associated with the C object
implementing the Gtk widget. GtkAda creates an Ada object for each Gtk
widget (and any other object) created by means of GtkAda. This object is
used as a proxy to the native C object when calls are made from Ada side.
It must be this way because Gtk has object-oriented design.

Gtk was developed with interoperability to other languages in mind. Many
GUI frameworks use a similar technique, when the widget carries an opaque
pointer to some user data.

C to Ada path works as follows. Gtk callbacks are captured by private
GtkAda's subroutines. They must exist anyway, since C convention is
required. These get the pointer to XXX_Record'Class from the C object and
route the call to the corresponding primitive operation of the Ada object. 

The user need not know all this mechanics. Everything looks like calling
Ada operations and Ada operations being called.

> If there was a simple little Ada widget toolkit that only had a C/C++
> core,

Meaning?

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2012-12-18 15:37 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-16 19:21 Ada Library, called, returns and continues ? Patrick
2012-12-16 19:51 ` Simon Wright
2012-12-16 20:26 ` Dmitry A. Kazakov
2012-12-16 23:13   ` Patrick
2012-12-17  8:59     ` Dmitry A. Kazakov
2012-12-17 15:58       ` Patrick
2012-12-17 17:08         ` Simon Wright
2012-12-17 17:43           ` Patrick
2012-12-17 18:09         ` Dmitry A. Kazakov
2012-12-17 19:41           ` Patrick
2012-12-17 21:26             ` Dmitry A. Kazakov
2012-12-17 23:42               ` Patrick
2012-12-18  0:30                 ` Randy Brukardt
2012-12-18  1:36                   ` Patrick
2012-12-18 23:10                     ` Randy Brukardt
2012-12-18  9:17                 ` Dmitry A. Kazakov
2012-12-18 15:00                   ` Patrick
2012-12-18 15:37                     ` Dmitry A. Kazakov [this message]
2012-12-18 16:14                       ` Patrick
2012-12-18 17:25                         ` Dmitry A. Kazakov
2012-12-18 16:50                   ` Robert A Duff
     [not found]                 ` <2nr1d89tvkc3h0dvcd62tpsf1vujsdb09o@invalid.netcom.com>
2012-12-18 23:54                   ` Patrick
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox