From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,3f2a5a3fc8bb8d4b X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!q27g2000prf.googlegroups.com!not-for-mail From: Adrian Hoe Newsgroups: comp.lang.ada Subject: Re: Interfacing with Objective-C or Python Date: Mon, 26 May 2008 01:48:00 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <70ae8db4-60f1-4069-8ebc-94d5afe38eaa@x1g2000prh.googlegroups.com> NNTP-Posting-Host: 60.53.234.228 Mime-Version: 1.0 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1211791680 19551 127.0.0.1 (26 May 2008 08:48:00 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 26 May 2008 08:48:00 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: q27g2000prf.googlegroups.com; posting-host=60.53.234.228; posting-account=coq9PAkAAAB2Xx46RZLFJw5dY9DVXW4- User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:353 Date: 2008-05-26T01:48:00-07:00 List-Id: On May 26, 4:25 pm, Ivan Levashew wrote: > Adrian Hoe =D0=C9=DB=C5=D4: > > > 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 call= s. > > 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/