SlideShare a Scribd company logo
Porting C/C++ to Symbian OS Mark Wilcox
What I’m Talking About   What is Porting? Why Port to Symbian OS? Porting Aids: P.I.P.S. OpenGL ES Open C/C++ & RGA Coming Soon… How to do it – The Porting Process Common Problems (& Solutions) Examples: Easy: SoundTouch More Complex: GuiTune
What is Porting? “ Porting is the process of adapting software so that an executable program can be created for a computing environment that is different from the one for which it was originally designed.” (Wikipedia) i.e. Making software work on different hardware or operating systems.
Why Port to Symbian OS?   The Marketing Reason… The Hacker’s Reason… The Geek’s Reason…
Porting Aids P.I.P.S. Is POSIX on Symbian OS OpenGL ES Open C/C++ for S60 RGA – Real-time Graphics & Audio
P.I.P.S. Is POSIX on Symbian OS POSIX – Portable Operating System Interface P.I.P.S. Libraries: 100 60 42 47 Function Coverage (%) Dynamic loading and symbol lookup  libdl Thread creation and synchronization   libpthread Mathematical and arithmetic APIs  libm Standard C and POSIX APIs  libc Functionality Library
OpenGL ES 2D & 3D graphics for embedded systems Subset of desktop OpenGL May need to switch floating-point to fixed 3D Demos:
Open C Superset of P.I.P.S. Adds support for 5 more libraries: 77 GNOME General purpose utility library libglib 86 OpenSSL OpenSSL secure sockets layer libssl 77 OpenSSL Cryptographic services for SSL, TLS, S/MIME, SSH, OpenPGP… libcrypto 100 OpenSSL Cryptography functions libcrypt 100 zlib In-memory compression and decompression functions libz Function Coverage (%) Source Functionality Library
Open C++ More useful libraries: Standard C++ programming extension for Open C Boost Smart pointers, extra containers and math-template functions Boost STLport C++ Standard Template Library STL STLport Standard C++ input/output streams IOStreams Source Functionality Library
Real-time Graphics & Audio Distributed with Open C/C++ APIs developed for porting N-Gage games Not a standard available anywhere else Can create rich UI without Symbian idioms Much more than just graphics & audio: 2D Graphics  Sound Effects and Music  Video Playback  Timers  Input Devices  Cameras Lights   Device Status and Capabilities   Calendar Alerts/Todo   Messaging
Open C/C++ & RGA Architecture
Coming Soon… Qt – cross-platform application framework OpenKODE – cross-platform native APIs Better standard C++ support on Symbian Full support for a dynamically linked STL Support for streams and locales Throwing operator new Better, though still limited, support for mixing standard C++ and Symbian C++ patterns Support for global destructors
How to do it – The Porting Process Convert build files Create a bld.inf file and MMP file(s) for the project Try to compile it Fix problems (loop until compiles) Try to run Debug and fix (loop until runs) Test Debug and fix (loop until works)
Common Problems (& Solutions) Symbian has E32Main(), while standard C/C++ uses main() Pre-Symbian OS v9.3 – add libcrt0.lib ‘glue code’ to your MMP file Symbian OS v9.3 onwards – use new target type STDEXE in the MMP file and ‘glue code’ is added automatically No functions exported from a library by default on Symbian OS Pre-Symbian OS v9.3 – add IMPORT_C to function declarations and EXPORT_C to the definitions for all exported functions Symbian OS v9.3 onwards – use new target types STDDLL or STDLIB and all functions with external linkage (non-static) are exported by default
Common Problems (& Solutions) Out of memory and/or Kern-Exec 3 panics at run-time Increase heap size via EPOCHEAPSIZE directive in the MMP file (although be aware that device memory is limited and code may need re-design and/or allocation failure checks) – default is only 1MB Increase stack size via EPOCSTACKSIZE directive in the MMP file – default is only 8KB, recommended value for Open C/C++ is 64KB
Common Problems (& Solutions) Standard library clashes for existing ports: There is an older partial implementation, developed to get a Java VM running on Symbian OS, in estlib.lib with headers in: \Epoc32\include\libc This is incompatible with P.I.P.S. & Open C/C++, the two cannot be used together. The estlib implementation will be deprecated when P.I.P.S. is considered sufficiently mature.  In practice P.I.P.S. is already much better.
Examples – SoundTouch DLL SoundTouch - open source Audio Processing Library For changing: Tempo (time-stretch) – faster or slower without affecting pitch Pitch (key) – alter sound pitch or key without affecting tempo Playback rate – alters tempo and pitch simultaneously Implemented in C++, using features of libc, libm and STL Supports 16bit integer or 32bit floating-point PCM Platform-independent – runs on Windows, Mac & Linux Can perform real-time processing on 133MHz Pentium
Examples – SoundTouch DLL Very simple bld.inf file: PRJ_PLATFORMS DEFAULT PRJ_EXPORTS ..\inc\SoundTouch.h ..\inc\ FIFOSamplePipe.h ..\inc\STTypes.h PRJ_MMPFILES SoundTouch.mmp
Examples – SoundTouch DLL Fairly simple MMP file (copy most contents from Makefile) TARGET  SoundTouch.dll TARGETTYPE  dll UID  0x1000008D 0x0839739D CAPABILITY  ReadUserData USERINCLUDE  ..\inc SYSTEMINCLUDE  \epoc32\include \epoc32\include\stdapis SYSTEMINCLUDE  \epoc32\include\stdapis\sys SYSTEMINCLUDE  \epoc32\include\stdapis\stlport  SOURCEPATH  ..\src SOURCE  SoundTouch.cpp SoundTouchDllMain.cpp AAFilter.cpp SOURCE  FIFOSampleBuffer.cpp FIRFilter.cpp SOURCE  RateTransposer.cpp TDStretch.cpp LIBRARY  euser.lib LIBRARY  libc.lib libm.lib libstdcpp.lib
Examples – SoundTouch DLL Additional work: Make sure all the source and header files are copied into the workspace Configure for 16bit integer samples in STTypes.h Add IMPORT_C & EXPORT_C to the exported function declarations and definitions Compiling gave several errors, all with the same cause throw std::runtime_error(&quot;Illegal number of channels&quot;);  Code like this: Should compile by simply including <stdexcept> but <string> is needed as well.  The string header should be included internally by <stdexcept> but it seems there is a bug in the Symbian version of STLport… With <string> included in the relevant files it compiles for all build targets.
Examples – GuiTune A more complex port of an open source guitar tuner for Linux. Converted a device driver polling architecture to use Symbian multimedia APIs
Examples – GuiTune Ported UI components from gtkmm to native Symbian controls
Examples – GuiTune Still relatively simple changes to the original code. Full details and code available from the Symbian Developer Network at: developer.symbian.com/main/documentation/porting/
Where to Find Out More P.I.P.S. wiki page: developer.symbian.com/wiki/display/pub/P.I.P.S. Forum Nokia Open C/C++ resources: www.forum.nokia.com/main/resources/technologies/openc_cpp/ Symbian Developer Network porting page: developer.symbian.com/main/documentation/porting/
Questions?

More Related Content

What's hot (20)

PPT
C compiler-ide
Synapseindiappsdevelopment
 
PDF
GNU Compiler Collection - August 2005
Saleem Ansari
 
PPT
GEM - GNU C Compiler Extensions Framework
Alexey Smirnov
 
PPT
Os Worthington
oscon2007
 
PDF
Assembly Langauge Chap 1
warda aziz
 
PDF
Pascal script maxbox_ekon_14_2
Max Kleiner
 
ODP
Open Source .NET
Onyxfish
 
PPTX
introduction to c language
Rai University
 
PPTX
Talk Python To Me: Stream Processing in your favourite Language with Beam on ...
Aljoscha Krettek
 
PDF
Embedded C programming based on 8051 microcontroller
Gaurav Verma
 
PDF
IBM XL Compilers Performance Tuning 2016-11-18
Yaoqing Gao
 
PDF
Ekon 25 Python4Delphi_MX475
Max Kleiner
 
PDF
Pythonic doesn't mean slow!
Ronan Lamy
 
PDF
Two-level Just-in-Time Compilation with One Interpreter and One Engine
Yusuke Izawa
 
PPTX
Introduction to C Language (By: Shujaat Abbas)
Shujaat Abbas
 
PPT
Introduction to llvm
Tao He
 
PDF
Introduction to Python GUI development with Delphi for Python - Part 1: Del...
Embarcadero Technologies
 
ODP
IDE as a Front-end and Fast time-to-market language support in Eclipse IDE re...
Mickael Istria
 
PDF
Introduction to the LLVM Compiler System
zionsaint
 
GNU Compiler Collection - August 2005
Saleem Ansari
 
GEM - GNU C Compiler Extensions Framework
Alexey Smirnov
 
Os Worthington
oscon2007
 
Assembly Langauge Chap 1
warda aziz
 
Pascal script maxbox_ekon_14_2
Max Kleiner
 
Open Source .NET
Onyxfish
 
introduction to c language
Rai University
 
Talk Python To Me: Stream Processing in your favourite Language with Beam on ...
Aljoscha Krettek
 
Embedded C programming based on 8051 microcontroller
Gaurav Verma
 
IBM XL Compilers Performance Tuning 2016-11-18
Yaoqing Gao
 
Ekon 25 Python4Delphi_MX475
Max Kleiner
 
Pythonic doesn't mean slow!
Ronan Lamy
 
Two-level Just-in-Time Compilation with One Interpreter and One Engine
Yusuke Izawa
 
Introduction to C Language (By: Shujaat Abbas)
Shujaat Abbas
 
Introduction to llvm
Tao He
 
Introduction to Python GUI development with Delphi for Python - Part 1: Del...
Embarcadero Technologies
 
IDE as a Front-end and Fast time-to-market language support in Eclipse IDE re...
Mickael Istria
 
Introduction to the LLVM Compiler System
zionsaint
 

Similar to Porting To Symbian (20)

PDF
Introduction-to-C-Part-1.pdf
AnassElHousni
 
PPTX
Advance Android Application Development
Ramesh Prasad
 
PPTX
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
bhargavi804095
 
PPTX
C++ helps you to format the I/O operations like determining the number of dig...
bhargavi804095
 
PPTX
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
meharikiros2
 
PPTX
Introduction-to-C-Part-1.pptx
NEHARAJPUT239591
 
PDF
PyCon2022 - Building Python Extensions
Henry Schreiner
 
PDF
Open frameworks 101_fitc
benDesigning
 
DOC
Introduction-to-C-Part-1 (1).doc
MayurWagh46
 
PPTX
Session 1 - c++ intro
VijayaNagarajan5
 
PPTX
Introduction to C programming
Rokonuzzaman Rony
 
PDF
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
corehard_by
 
PDF
Exploring the Programming Models for the LUMI Supercomputer
George Markomanolis
 
PPTX
Understanding how C program works
MindBridgeTech
 
PPTX
C++Basics2022.pptx
Danielle780357
 
PPT
C_Intro.ppt
gitesh_nagar
 
PPT
C PROGRAMMING
Stalongiles Philip
 
PPT
C intro
Mohit Patodia
 
PDF
C programming first_session
Keroles karam khalil
 
PDF
C programming first_session
Keroles karam khalil
 
Introduction-to-C-Part-1.pdf
AnassElHousni
 
Advance Android Application Development
Ramesh Prasad
 
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
bhargavi804095
 
C++ helps you to format the I/O operations like determining the number of dig...
bhargavi804095
 
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
meharikiros2
 
Introduction-to-C-Part-1.pptx
NEHARAJPUT239591
 
PyCon2022 - Building Python Extensions
Henry Schreiner
 
Open frameworks 101_fitc
benDesigning
 
Introduction-to-C-Part-1 (1).doc
MayurWagh46
 
Session 1 - c++ intro
VijayaNagarajan5
 
Introduction to C programming
Rokonuzzaman Rony
 
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
corehard_by
 
Exploring the Programming Models for the LUMI Supercomputer
George Markomanolis
 
Understanding how C program works
MindBridgeTech
 
C++Basics2022.pptx
Danielle780357
 
C_Intro.ppt
gitesh_nagar
 
C PROGRAMMING
Stalongiles Philip
 
C intro
Mohit Patodia
 
C programming first_session
Keroles karam khalil
 
C programming first_session
Keroles karam khalil
 
Ad

Recently uploaded (20)

PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
July Patch Tuesday
Ivanti
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Python basic programing language for automation
DanialHabibi2
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
July Patch Tuesday
Ivanti
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Python basic programing language for automation
DanialHabibi2
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Ad

Porting To Symbian

  • 1. Porting C/C++ to Symbian OS Mark Wilcox
  • 2. What I’m Talking About What is Porting? Why Port to Symbian OS? Porting Aids: P.I.P.S. OpenGL ES Open C/C++ & RGA Coming Soon… How to do it – The Porting Process Common Problems (& Solutions) Examples: Easy: SoundTouch More Complex: GuiTune
  • 3. What is Porting? “ Porting is the process of adapting software so that an executable program can be created for a computing environment that is different from the one for which it was originally designed.” (Wikipedia) i.e. Making software work on different hardware or operating systems.
  • 4. Why Port to Symbian OS? The Marketing Reason… The Hacker’s Reason… The Geek’s Reason…
  • 5. Porting Aids P.I.P.S. Is POSIX on Symbian OS OpenGL ES Open C/C++ for S60 RGA – Real-time Graphics & Audio
  • 6. P.I.P.S. Is POSIX on Symbian OS POSIX – Portable Operating System Interface P.I.P.S. Libraries: 100 60 42 47 Function Coverage (%) Dynamic loading and symbol lookup libdl Thread creation and synchronization libpthread Mathematical and arithmetic APIs libm Standard C and POSIX APIs libc Functionality Library
  • 7. OpenGL ES 2D & 3D graphics for embedded systems Subset of desktop OpenGL May need to switch floating-point to fixed 3D Demos:
  • 8. Open C Superset of P.I.P.S. Adds support for 5 more libraries: 77 GNOME General purpose utility library libglib 86 OpenSSL OpenSSL secure sockets layer libssl 77 OpenSSL Cryptographic services for SSL, TLS, S/MIME, SSH, OpenPGP… libcrypto 100 OpenSSL Cryptography functions libcrypt 100 zlib In-memory compression and decompression functions libz Function Coverage (%) Source Functionality Library
  • 9. Open C++ More useful libraries: Standard C++ programming extension for Open C Boost Smart pointers, extra containers and math-template functions Boost STLport C++ Standard Template Library STL STLport Standard C++ input/output streams IOStreams Source Functionality Library
  • 10. Real-time Graphics & Audio Distributed with Open C/C++ APIs developed for porting N-Gage games Not a standard available anywhere else Can create rich UI without Symbian idioms Much more than just graphics & audio: 2D Graphics Sound Effects and Music Video Playback Timers Input Devices Cameras Lights Device Status and Capabilities Calendar Alerts/Todo Messaging
  • 11. Open C/C++ & RGA Architecture
  • 12. Coming Soon… Qt – cross-platform application framework OpenKODE – cross-platform native APIs Better standard C++ support on Symbian Full support for a dynamically linked STL Support for streams and locales Throwing operator new Better, though still limited, support for mixing standard C++ and Symbian C++ patterns Support for global destructors
  • 13. How to do it – The Porting Process Convert build files Create a bld.inf file and MMP file(s) for the project Try to compile it Fix problems (loop until compiles) Try to run Debug and fix (loop until runs) Test Debug and fix (loop until works)
  • 14. Common Problems (& Solutions) Symbian has E32Main(), while standard C/C++ uses main() Pre-Symbian OS v9.3 – add libcrt0.lib ‘glue code’ to your MMP file Symbian OS v9.3 onwards – use new target type STDEXE in the MMP file and ‘glue code’ is added automatically No functions exported from a library by default on Symbian OS Pre-Symbian OS v9.3 – add IMPORT_C to function declarations and EXPORT_C to the definitions for all exported functions Symbian OS v9.3 onwards – use new target types STDDLL or STDLIB and all functions with external linkage (non-static) are exported by default
  • 15. Common Problems (& Solutions) Out of memory and/or Kern-Exec 3 panics at run-time Increase heap size via EPOCHEAPSIZE directive in the MMP file (although be aware that device memory is limited and code may need re-design and/or allocation failure checks) – default is only 1MB Increase stack size via EPOCSTACKSIZE directive in the MMP file – default is only 8KB, recommended value for Open C/C++ is 64KB
  • 16. Common Problems (& Solutions) Standard library clashes for existing ports: There is an older partial implementation, developed to get a Java VM running on Symbian OS, in estlib.lib with headers in: \Epoc32\include\libc This is incompatible with P.I.P.S. & Open C/C++, the two cannot be used together. The estlib implementation will be deprecated when P.I.P.S. is considered sufficiently mature. In practice P.I.P.S. is already much better.
  • 17. Examples – SoundTouch DLL SoundTouch - open source Audio Processing Library For changing: Tempo (time-stretch) – faster or slower without affecting pitch Pitch (key) – alter sound pitch or key without affecting tempo Playback rate – alters tempo and pitch simultaneously Implemented in C++, using features of libc, libm and STL Supports 16bit integer or 32bit floating-point PCM Platform-independent – runs on Windows, Mac & Linux Can perform real-time processing on 133MHz Pentium
  • 18. Examples – SoundTouch DLL Very simple bld.inf file: PRJ_PLATFORMS DEFAULT PRJ_EXPORTS ..\inc\SoundTouch.h ..\inc\ FIFOSamplePipe.h ..\inc\STTypes.h PRJ_MMPFILES SoundTouch.mmp
  • 19. Examples – SoundTouch DLL Fairly simple MMP file (copy most contents from Makefile) TARGET SoundTouch.dll TARGETTYPE dll UID 0x1000008D 0x0839739D CAPABILITY ReadUserData USERINCLUDE ..\inc SYSTEMINCLUDE \epoc32\include \epoc32\include\stdapis SYSTEMINCLUDE \epoc32\include\stdapis\sys SYSTEMINCLUDE \epoc32\include\stdapis\stlport SOURCEPATH ..\src SOURCE SoundTouch.cpp SoundTouchDllMain.cpp AAFilter.cpp SOURCE FIFOSampleBuffer.cpp FIRFilter.cpp SOURCE RateTransposer.cpp TDStretch.cpp LIBRARY euser.lib LIBRARY libc.lib libm.lib libstdcpp.lib
  • 20. Examples – SoundTouch DLL Additional work: Make sure all the source and header files are copied into the workspace Configure for 16bit integer samples in STTypes.h Add IMPORT_C & EXPORT_C to the exported function declarations and definitions Compiling gave several errors, all with the same cause throw std::runtime_error(&quot;Illegal number of channels&quot;); Code like this: Should compile by simply including <stdexcept> but <string> is needed as well. The string header should be included internally by <stdexcept> but it seems there is a bug in the Symbian version of STLport… With <string> included in the relevant files it compiles for all build targets.
  • 21. Examples – GuiTune A more complex port of an open source guitar tuner for Linux. Converted a device driver polling architecture to use Symbian multimedia APIs
  • 22. Examples – GuiTune Ported UI components from gtkmm to native Symbian controls
  • 23. Examples – GuiTune Still relatively simple changes to the original code. Full details and code available from the Symbian Developer Network at: developer.symbian.com/main/documentation/porting/
  • 24. Where to Find Out More P.I.P.S. wiki page: developer.symbian.com/wiki/display/pub/P.I.P.S. Forum Nokia Open C/C++ resources: www.forum.nokia.com/main/resources/technologies/openc_cpp/ Symbian Developer Network porting page: developer.symbian.com/main/documentation/porting/