Re: [LONG] Making the right choice (was Re: How viable is Cocoa development?)
Re: [LONG] Making the right choice (was Re: How viable is Cocoa development?)
- Subject: Re: [LONG] Making the right choice (was Re: How viable is Cocoa development?)
- From: Finlay Dobbie <email@hidden>
- Date: Sun, 27 Jan 2002 10:41:30 +0000
On Sunday, January 27, 2002, at 09:52 AM, David Niemeijer wrote:
1) Can I call Carbon from an Obj-C, Obj-C++, C, or C++ file that is
part of a Cocoa application? If so, what special steps need to be taken?
Carbon is just a C API. You can call it the same way you call any C
function under any normal circumstances in any of the files you
mentioned above.
2) Can I, from a cocoa application, easily access a plug-in or shared
library containing Carbon based code? If so, what special steps need to
be taken?
Do whatever you like.
3) Can I easily share Cocoa Foundation Framework objects with
"equivalent" Carbon Core Foundation objects, i.e. pass them along
between Cocoa and Carbon code? If so, what special steps need to be
taken?
Most of the base CF types are toll-free bridged with Foundation objects,
so you can just cast between them. NSString * = CFStringRef, etc. A full
list is available in the release notes and this has been discussed
before on the list. Please do some research of your own instead of
relying on people to feed you information with a spoon.
4) How easy or difficult is it to put a Cocoa front-end (i.e. User
Interface) on a Carbon based core? Would everything have to be done in
PB or could the Carbon core be done in CW and "exported" to PB/Cocoa?
Carbon-based core? Your core shouldn't really rely on Carbon that much,
because Carbon is mostly involved with UI and things like that. Why on
earth you'd want to use a mixture of CW and PB, I have no idea, but if
you create a Mach-O library then you can call that from Cocoa (and just
any program at all, basically).
1) How integrated multiprocessing and threading are in Cocoa?
If you extensively use threading in a Cocoa application then, when it is
run on an MP machine, the threads will automatically be scheduled over
the 2 processors. Threading is pretty easy, it's just a case of using
NSThread to detach a new thread to a selector. The only caveat is that
lots of Cocoa isn't thread-safe, and you can only really safely
manipulate the user interface from the main thread, so you have to use
DO or something to set up a communication channel between the two.
Again, this has been discussed time and time again. Please do some
research of your own.
2) How integrated AppleScript is in Cocoa?
Please read the Developer Documentation to get an idea.
3) How large the speed penalty under Cocoa is when working with
extremely large files and large numbers of objects (instead of plain
data records/structs).
Well, depends entirely on the circumstances, but you can obviously use
plain data records/structs for speed increases where needed, since
Obj-C == C + extensions.
-- Finlay