Re: Cocoa/Windows parallel dvlpmt
Re: Cocoa/Windows parallel dvlpmt
- Subject: Re: Cocoa/Windows parallel dvlpmt
- From: Erez Anzel <email@hidden>
- Date: Sat, 31 Jan 2004 20:26:25 -0500
Thanks, Darrin; you've given good advice on multiple planes. Don't
worry; I don't take good advice as an insult. I don't even take bad
advice as an insult, as long as it is offered in good faith. If I knew
everything, I wouldn't be seeking advice. And I consider my knowledge
to be relatively minimal.
I figure on Virtual PC for two particular reasons: all my development
can be on one PowerBook, which I can travel with, work and demonstrate
on, etc.; and I figure it will be convenient when two development
systems can access all their common files on one internal hard drive.
I may yet hire a Window developer to guide me through the jungle. How
hard can it be? (Famous last words!) I am not so concerned about my
product being pretty; I'm focusing on utility at first.
My current Cocoa app accesses many C++ files which I created while
using CodeWarrior and PowerPlant. (I want to wean myself off of
PowerPlant, by removing from my code any last depencies upon it.) My
"engine" is all C++. I've learned to mix and match where necessary. I
use STL vectors etc. in many of those files. All my C++ implementation
files have .mm suffices now, though I guess that I may have to change
some setting in Xcode and switch back to .cpp for the benefit of
Microsoft tools.
The Core Foundation C++ object approach may be very helpful. If such an
object can bridge toll-free with equivalent Cocoa/Objective-C objects,
and also work in a Microsoft world, then it saves me a lot of trouble.
But I'll have to research this further; I've never looked at Core
Foundation. I take advantage of the fact that my current model's
objects are instantiations of NSObject subclasses; I don't know if I
can have my cake and eat it too.
Thanks again...Erez
On 31-Jan-04, at 6:52 PM, Darrin Cardani wrote:
At 1:11 PM -0800 1/31/04, Erez Anzel <email@hidden> wrote:
I have been happily developing in Cocoa using XCode 1.1. But I have to
port to Windows, very quickly. ...
I know almost nothing of Windows, MFC, Visual C++, etc. I have no idea
how (or if) they implement multiple Undo, for instance. I have never
touched Windows, and don't have a Windows machine; I figure I'd start
with Virtual PC for Mac.
Please don't take this as an insult, but from the above description,
it sounds like you're potentially setting yourself up for failure.
What you want to do can certainly be done, but it sounds like you
don't know enough about Windows to even know where to begin, let alone
get it done quickly. I wonder if you might be better off finding a
Windows developer and splitting the profits of the Windows version
with him/her. Or maybe help them port their Windows app to the Mac in
exchange, or something.
To be sure, you can do real Windows development on Virtual PC. I
currently write high end video editing plugins that work on both Mac
OS and Windows using CodeWarrior on the Mac. I compile the Windows
version on one Mac and debug using the Mac/Windows cross debugger with
Virtual PC running on another Mac. However, I need very little in the
way of user interface for my plugins, as the host application handles
most of that for me, so it's probably easier for me than it will be
for you, since it sounds like your app will be UI intensive. (The
price of a cheap no-name PC is not too much more than the price of
Virtual PC, but you do have to factor in the additional space,
electricity, etc. you'll end up using, too.)
I am not sure if I should have two separate models (in the MVC sense).
In Cocoa I could use NSMutableArray, and each of my objects could be
an
NSObject subclass, which is what I have now. In Windows I'd have some
parallel.
I'm working on another project in Cocoa that is currently Mac-only,
but the customer has started thinking about doing a Windows port. What
I've done is written the model objects in C++ using Core Foundations
for most of my containers and to handle Unicode text. As I understand
it, you can get the source to much of Core Foundations from Darwin and
compile it for x86. I haven't tried this yet, so I don't know for sure
if it will work, but I'm looking into it. It works nicely with Cocoa
because CFStrings, CFArrays, and CFDictionaries use the "toll-free
bridge" with NSStrings, NSArrays, and NSDictionaries. So my C++ code
can store an array of strings, and the Obj-C code can directly use
those objects. On the Windows side, I'll have to do some conversion
when I need to pass the resulting string to an OS routine, but that's
not too difficult.
Or should I use STL lists or vectors, and then in Cocoa have
a model object which owns the STL list of raw C++ objects, and do
likewise in Windows.
As I understand it, you can't use STL in Cocoa code. If nothing else,
you'll have problems with templates because of the "<>" bracket
syntax, if I recall correctly.
For actions upon my objects, I'd perhaps use some
Objective-C wrapper in Cocoa as I operate on each individual object.
That might, however, be very inefficient.
That could work. Or you could have your (model) objects be C++ objects
and use them directly in both Cocoa and MFC. You can pretty easily mix
Obj-C and C++, so long as you follow the few rules that Apple outlines
in their description of how to do it. (You need to understand that
destructors won't get called for stack-based C++ objects in
Objective-C, so you need to always allocate and delete C++ objects in
the heap, for example.) You can find more in the developer docs that
get installed with XCode in /Developer/Documentation/. (Sorry, I can't
find the exact path at the moment.)
Any pointers, guidance, etc. would be greatly appreciated. When I have
more cash, I'll hire someone who knows what they're doing.
Well, just be sure you get to the point where you get more cash. :-)
It takes a lot of hard work to launch a product successfully on one
platform, let alone 2. Good luck!
Darrin
--
Darrin Cardani - email@hidden
President, Buena Software, Inc.
<http://www.buena.com/>
Video, Image and Audio Processing Development
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.