comp.lang.ada
 help / color / mirror / Atom feed
From: Adrian Hoe <abyhoe@gmail.com>
Subject: Re: Interfacing with Objective-C or Python
Date: Mon, 26 May 2008 01:48:00 -0700 (PDT)
Date: 2008-05-26T01:48:00-07:00	[thread overview]
Message-ID: <c82ac685-81b1-4976-aaf6-ae468cd838da@q27g2000prf.googlegroups.com> (raw)
In-Reply-To: g1drq0$3g5$1@registered.motzarella.org

On May 26, 4:25 pm, Ivan Levashew <octag...@bluebottle.com> wrote:
> Adrian Hoe пишет:
>
> > Is there any way to interface Ada with Objective-C (or Python) without
> > having a wrapper? Has anyone done this before?
>
> Objective-C from Apple and from FSF have different way of dispatching calls.
>
> Apple's one has objc_sendMsg varargs function. The best way is to have a
> C wrapper for every kind of varargs invokation since one can't be sure
> if passing some kind of argument is equivalent to passing it as a
> varargs argument. But if one is sure, one can completely eliminate ObjC
> wrapper. objc_sendMsg must be imported several times for every
> combination of arguments one is going to use it with. One will also need
> to map selectors' string representation to their integer representation
> with NSSelectorFromString. Frozen constant will do.
>
> Then one just calls objc_sendMsg (objc-class-or-object, selector, arg1,
> arg2, ...). And also reference counting: Controlled's Adjust/Finalize
> must be mapped to NeXTSTEP's retain/release. I don't know much about
> exception handling.
>
> > without having a wrapper?
>
> ObjectiveC is like C++. There are at least 3 incompatible
> implementations: Apple, FSF, POC*. One either make a wrapper or go into
> details and make implementation-dependent binding. Cocoa APIs are
> partially duplicated in GNUStep and Cocotron, and Apple is rumored to
> release Cocoa for Windows [1] currently being tested on Safari for
> Windows. So it's usually better to make portable bindings. Since Skype
> API on Mac OS X is likely to remain tied to Apple ObjC, Skype is an
> exception.
>
> What's the point in not having a wrapper?
>
> *) Portable Object Compiler
> [1]http://www.roughlydrafted.com/RD/RDM.Tech.Q2.07/A35C23B9-BD22-4478-BC...


The point of not having a wrapper is to have less language involved.
Currently, the development is in pure Ada and will only involve call
to Skype's API via Objective-C. If there is way to directly interface
with Objective-C without writing a C-wrapper, so much better.

But looks like a C-wrapper is inevitable, isn't it?
--
Adrian Hoe
http://adrianhoe.com/adrianhoe/




  reply	other threads:[~2008-05-26  8:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-26  6:47 Interfacing with Objective-C or Python Adrian Hoe
2008-05-26  8:25 ` Ivan Levashew
2008-05-26  8:48   ` Adrian Hoe [this message]
2008-05-26  9:18     ` Ivan Levashew
2008-06-01  1:28       ` Adrian Hoe
2008-05-26  9:02 ` Sébastien
2008-06-01 19:40 ` [OT] Skype is dangerous (was 'Re: Interfacing with Objective-C or Python') Ivan Levashew
replies disabled

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