Cross-platform development
             for
           iPhone
   Contributor: Tovchenko Taras
           (Doctor Set)
Plan

• What is cross-platform development
• Benefits & Expenses
• Implementation - 2 ways
• Use open source libraries
• A&Q
What does this mean “cross-platform”?


      1. GUI         2. Business logic
GUI porting is very bag applicable from
    iPhone to desktop platforms




                      -?
How we can distribute business logic?


 1. Base logic - memory, containers, etc.
 2. Logic of your application
 3. Graphi...
What applications we can create full
cross-platform and what can be created
               particles?


1. (Full) Games - ...
Expenses
1. If you write 2 applications = you pay x2 $
2. Or you can write 1 application for 2 markets = x1.1 - x1.7 $
Several paths for attainment cross-platform




 • Porting existing code
 • Write new code than will be oriented to
    cr...
Porting
If you have already wrote project - use this method


                   Problems

1. Existing code wrote on langu...
Solutions

•   For problem with code we can use some
    emulators of objective-c code - qobjc runtime,
    cocotron libra...
Open Source libraries
•   For code porting (objc) currently we don’t have
    optimal solutions. Almost all libraries desi...
Solutions for code porting


Lib name       License       Compiler
Cocotron        MIT            GCC
GNUStep         GPL ...
qobjc (quick)
             http://code.google.com/p/qobjc


   Scientific project, this is worked, tested runtime of
      ...
Objective-C
        @interface MyDecl : BaseClass <QMyProto2> {
            int _someInt;
            double _someDouble;
...
New Code
       What benefits?
We can write code on already portable
language as - C++, and some scripting
     languages -...
Objective-C

-?       (speciality 2.0)
     is not cross-platform
dCocoa
     http://code.google.com/p/dcocoa

               LGPL license

Author’s library for cross-platform
implementati...
What give your dCocoa now?



1. Convenient Objective-C mechanisms
   emulation. This library writes on C++ and
   approxi...
1. Keep meta-information
2. Memory management (retain count,
   autorelease pools)
3. Containers (array, set, dictionary) ...
Objective-C                             dCocoa

@interface MyClass : NSObject {   class MyClass : public CL::dObject {
}  ...
A&Q

Written by Taras Tovcheko, 2009/07/18
    e-mail: doctorset@gmail.com
Upcoming SlideShare
Loading in …5
×

Разработка кросс-платформенного кода между iPhone &lt; -> Windows с помощью open-source библиотек

961 views

Published on

Published in: Technology, News & Politics
  • Be the first to comment

Разработка кросс-платформенного кода между iPhone &lt; -> Windows с помощью open-source библиотек

  1. 1. Cross-platform development for iPhone Contributor: Tovchenko Taras (Doctor Set)
  2. 2. Plan • What is cross-platform development • Benefits & Expenses • Implementation - 2 ways • Use open source libraries • A&Q
  3. 3. What does this mean “cross-platform”? 1. GUI 2. Business logic
  4. 4. GUI porting is very bag applicable from iPhone to desktop platforms -?
  5. 5. How we can distribute business logic? 1. Base logic - memory, containers, etc. 2. Logic of your application 3. Graphic output (OpenGL, convertors) 4. Audio output (OpenAL) 5. Databases
  6. 6. What applications we can create full cross-platform and what can be created particles? 1. (Full) Games - 60% at all iPhone applications 2. (Medium) Scientific applications which use graphic output - medical, engineering, etc. 3. (Not applicable) Applications based on iPhone GUI
  7. 7. Expenses 1. If you write 2 applications = you pay x2 $ 2. Or you can write 1 application for 2 markets = x1.1 - x1.7 $
  8. 8. Several paths for attainment cross-platform • Porting existing code • Write new code than will be oriented to cross-platform
  9. 9. Porting If you have already wrote project - use this method Problems 1. Existing code wrote on language which not compile on other platforms, often this is Objective-C 2. On a project was used system depended api (on iPhone this is POSIX) 3. GUI - which can’t be ported automatically to other platforms
  10. 10. Solutions • For problem with code we can use some emulators of objective-c code - qobjc runtime, cocotron library. • For system api we can writes wrappers than will be defined on concrete platform. • GUI - for better case need redesign, for second case you can write some automatic engine for your dialogs.
  11. 11. Open Source libraries • For code porting (objc) currently we don’t have optimal solutions. Almost all libraries designed for Windows <-> Mac OS but not for iPhone. But we can use its for: 1. Learning and looking to its implementations 2. Improve this libraries for iPhone
  12. 12. Solutions for code porting Lib name License Compiler Cocotron MIT GCC GNUStep GPL GCC qobjc Author’s, GPL Visual Studio
  13. 13. qobjc (quick) http://code.google.com/p/qobjc Scientific project, this is worked, tested runtime of Objective-C language Problem: this is only runtime lib, but for full functionality need code parser
  14. 14. Objective-C @interface MyDecl : BaseClass <QMyProto2> { int _someInt; double _someDouble; float _someFloat; } - (float)calculateArea:(float)v0 :(float)v1 :(double)v2 :(float)v3 :(float)v4; - (void)dealloc; // in objective-c this method not need declare on header :) Macro code on qobjc Q_BEGIN_CLASS(MyDecl, BaseClass)         Q_INCLUDE_PROTOCOL_TO_CLASS(QMyProto2)         Q_BEGIN_IVAR_LIST             Q_DEF_IVAR(_someInt, i)             Q_DEF_IVAR(_someDouble, d)             Q_DEF_IVAR(_someFloat, f)         Q_END         Q_BEGIN_INSTANCE_METHOD_LIST             Q_DEF_METHOD(calculateArea:, _calcAreaXY, +f+f+f+d+f+f)             Q_DEF_METHOD(dealloc, _dealloc1, +v)         Q_END_INSTANCE_METHOD_LIST     Q_END_CLASS
  15. 15. New Code What benefits? We can write code on already portable language as - C++, and some scripting languages - LUA, PostScript For implementing system API uses libraries (mostly C++) which wraps this work - example dCocoa, QT
  16. 16. Objective-C -? (speciality 2.0) is not cross-platform
  17. 17. dCocoa http://code.google.com/p/dcocoa LGPL license Author’s library for cross-platform implementation business logics for iPhone and with possibility run or develop this logic on Windows platform.
  18. 18. What give your dCocoa now? 1. Convenient Objective-C mechanisms emulation. This library writes on C++ and approximates to Foundation framework with almost all objc-runtime features. 2. Cross-platform between iPhone <-> Windows
  19. 19. 1. Keep meta-information 2. Memory management (retain count, autorelease pools) 3. Containers (array, set, dictionary) in 2 form - for standard C++ types and dcocoa types 4. System dependent features (threads, TLS, timer, run-loop, etc) 5. Other helper classes (such as invocation, etc)
  20. 20. Objective-C dCocoa @interface MyClass : NSObject { class MyClass : public CL::dObject { } COCOA_CLASS_DECLARE(MyClass) + (void)method1; typedef CL::dObject _super; - (void)method2; public: virtual MyClass* initWith(t a); void func() { void method1(); // or virtual NSAutoreleasePool* pool = [[NSAutorelease alloc] init]; METHOD_DECLARE(method2) // meta }; id obj = [[MyClass alloc] void func() { initWith:5]; _LocalPool [_someObject addTarget:obj CL::dObject* obj = selector:@selector(method2)]; MyClass::alloc()->initWith(5); _someObject->addTargetSelector( [obj release]; obj, dselector(method2)); [pool release]; } CoRelease(obj); }
  21. 21. A&Q Written by Taras Tovcheko, 2009/07/18 e-mail: doctorset@gmail.com

×