[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Embed ObjC in an API library?
From: |
Helge Hess |
Subject: |
Re: Embed ObjC in an API library? |
Date: |
Mon, 26 May 2003 11:33:21 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3.1) Gecko/20030425 |
Kaelin Colclasure wrote:
Is it possible to implement a set of functions in Objective C, and then
wrap them with a plain-old C interface and package them as a shared
library?
Yes. You actually only need to wrap them to make it more convenient for
the C-developer. You can call any Objective-C method/class in ANSI-C by
using the Objective-C runtime, eg:
#include <objc/objc.h>
objc_msg_lookup(myObject, sel_get_uid("doIt:"))
(myObject, myArg);
Of course it probably makes more sense to wrap that, eg in
wrapper.m:
void MyObject_doIt(id myObject, int arg) {
[myObject doIt:arg];
}
wrapper.h:
extern void MyObject_doIt(id myObject, int arg);
Personally I would really like to see a full, supported and stable
ANSI-C API to Foundation, since that makes embedding easier.
And if it is, would one be able to use the GNUstep foundation
classes in such an endeavor?
Yes. But of course you need to provide a proper environment and you
probably need to call some initializers.
> And finally, would one be able to pull this
off on Win32 as well?
Yes, why not. You just need to link against all relevant DLLs, like
libobjc and libgstep-base.
regards,
Helge
--
__________________________________________________________________
Helge Hess Email: helge.hess@skyrix.com
SKYRIX Software AG Tel: +49-391-6623-0
Universitaetsplatz 12 Fax: +49-391-6623-599
39104 Magdeburg, Germany Internet: http://www.skyrix.com
__________________________________________________________________
Exchange your Exchange http://developer.skyrix.com/
__________________________________________________________________