Hybrid Applications with Symbian C++ and Standard C

If the developers want to use any of the P.I.P.S. APIs while writing some Symbian application, they need to link to the corresponding library. The only difference being that the developer does not have to link with the STATICLIBRARY libcrt0.lib in the MMP file.

There are no additional P.I.P.S. specific changes that need to be done in the source file in this case. This is possible, because the P.I.P.S. developer of does not have to call any library initialization routine before use or cleanup routine after use.

Some of the P.I.P.S. APIs assume that a cleanup stack is created and there is a top-level TRAP. If the developer does not create either of the two, calling such APIs may lead to application crash.

Note: In a hybrid application, the user must

make sure that the cleanup stack is created and a top-level TRAP marker is done.

Hybrid application can also contain threads created using both RThread::Create() and pthread_create(), and can still use P.I.P.S. APIs in both the threads. In case of RThread::Create() the developer has to create cleanup stack and a top level TRAP for this thread in the thread entry Function, if it is required; else this thread may crash or panic.

An application can have both C++ and C source codes. In this case, in order to give C linkage to C++ code- that is calling a function defined in a C++ file that may have C++ code, use extern “C”. For example:

// File: sample.c
  void OtherFoo();
  
  void Foo() {
     OtherFoo();
  }

// File: useme.cpp
  
  extern “C” {
  void OtherFoo() {
     //Can use any C++ code here
     //Can use Symbian C++ code here
  }
  }