Multi-platform applications with Objective-C? Maybe.

34 views
Skip to first unread message

offwhite

unread,
May 8, 2010, 6:13:22 PM5/8/10
to Midwest iPhone SDK Developers
http://cocoawithlove.com/2010/04/design-of-multi-platform-app-using.html

This article shows how to build an app for multiple platforms using
Objective-C. It helps that much of the core libraries like
CoreFoundation are available as Open Source so they can be compiled on
Windows.

For a static library to work, it must be compiled for the CPU
architecture and the iPhone and Android phones currently have the ARM
architecture. I am not expert on these details though. Building for
multiple architectures requires a great deal of set up which with
Xcode is handled for you so that building for the iPhone Simulator
(x64 arch) and the iPhone/iPad device (ARM arch) is already done for
you. Setting it up to build on Windows is another matter.

Then you need to link and bind to this static library with whatever
native code you are going to be using. This may be Java for Android
and Blackberry and C# for the coming Windows Phone 7.

It's a good deal of work, but maybe if a strong group of developers
created the build environment as a part of an Open Source project
maybe Objective-C could be used for the core logic of mobile apps.

But why Objective-C? You may argue that there are already a lot of
iPhone apps available with lots of code written for mobile apps.
Objective-C would also allow you to leverage CoreFoundation.
Alternatively you might want to choose C which is more low level and
does not offer some of the benefits of Objective-C. You could build
your static libraries with Objective-C on the Mac with Xcode along
with the debugging and testing features to build a robust library. The
tools that make up the Xcode IDE are pretty good which does help the
developer be productive, providing an advantage over C.

Now just because I could do this, why would I consider it? Would
porting Objective-C to Java and C# really be that much work? I guess
it depends on the size of your code base and the number of features in
your app.

Anyway, it is an interesting idea. What do you think?

--
You received this message because you are subscribed to the Google Groups "Midwest iPhone SDK Developers" group.
To post to this group, send email to mwiph...@googlegroups.com.
To unsubscribe from this group, send email to mwiphonesdk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mwiphonesdk?hl=en.

offwhite

unread,
May 8, 2010, 7:31:14 PM5/8/10
to Midwest iPhone SDK Developers
http://sites.google.com/site/michaelsafyan/coding/articles/iphone/cross-compilingfortheiphoneusingcmakereprise

This post links over to an example of building the Apache Portable
Runtime for the iPhone Simulator and the device. It would make C a
more viable option as a core library for the iPhone. For code in app
that needs to maximize performance I have read that C is preferred
over Objective-C because the Objective-C runtime adds some overhead
that can be avoided by going straight to C.

With the APR you would have a well tested and major cross-platform
abstraction layer for networking, filesystem and other common needs.

So it is another potential option for sharing code across platforms.

Brennan
Reply all
Reply to author
Forward
0 new messages