obj-c runtime and language bindings.

From:

Pascal J . Bourguignon

Subject:

obj-c runtime and language bindings.

Date:

Mon, 8 Dec 2003 16:35:38 +0100

Daniel Rogers writes:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> hi --
>
> How well does the objective-c runtime lend it self to language bindings?
> ~ Specifically, is the object data structures well defined? Can
> inheritance be defined with a function call? Do language binding have
> to get chummy with the compiler to handle inheritance? Can a language
> binding create a derived type of an objective-c class, then have another
> objective-c class derive from the forgien language binding?
>
> Basically, I am curious if objective-c can handle language bindings like
> gobject can.
Objective-C runtime is defined in pure C. Contrarily to C++,
Objective-C is a _strict_ superset of C. That is, you can compile any
C program with an Objective-C compiler AND obtain a meaningfull
executable, which can't be said of C++.
So any external binding you can write in C, you can write in
Objective-C because it's written exactly the same.
On the other hand, if you want to handle Objective-C classes, objects
and messages from another languages that can bind to C functions, then
there's no problem other than there is no _standard_ runtime API.
That means that you can do it without any difficulty, but it will only
work for the runtime you choose: Apple's or GNU's. On the other hand,
since there remain only two Objective-C runtimes alive, it's no big
deal to implement bindings for both, and they're not much different.
For an example, you may have a look at guile, or at the bindings to
Apple's Objective-C runtime from OpenMCL (CCL).
--
__Pascal_Bourguignon__ . * * . * .* .
http://www.informatimago.com/ . * . .*
* . . /\ () . *
Living free in Alaska or in Siberia, a . . / .\ . * .
grizzli's life expectancy is 35 years, .*. / * \ . .
but no more than 8 years in captivity. . /* o \ .
http://www.theadvocates.org/ * '''||''' .
SCO Spam-magnet: address@hidden ******************