Symbian3/PDK/Source/GUID-C7589C93-B517-4251-ACFB-B03E07993242.dita
changeset 1 25a17d01db0c
child 3 46218c8b8afa
equal deleted inserted replaced
0:89d6a7a84779 1:25a17d01db0c
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-C7589C93-B517-4251-ACFB-B03E07993242" xml:lang="en"><title>Hybrid
       
    13 Applications with Symbian C++ and Standard C</title><shortdesc/><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    14 <p>If the developers want to use any of the P.I.P.S. APIs while writing some
       
    15 Symbian application, they need to link to the corresponding library. The only
       
    16 difference being that the developer does not have to link with the <codeph>STATICLIBRARY</codeph> <filepath>libcrt0.lib</filepath> in
       
    17 the MMP file.</p>
       
    18 <p>There are no additional P.I.P.S. specific changes that need to be done
       
    19 in the source file in this case. This is possible, because the P.I.P.S. developer
       
    20 of does not have to call any library initialization routine before use or
       
    21 cleanup routine after use.</p>
       
    22 <p>Some of the P.I.P.S. APIs assume that a cleanup stack is created and there
       
    23 is a top-level TRAP. If the developer does not create either of the two, calling
       
    24 such APIs may lead to application crash. </p>
       
    25 <note>In a hybrid application, the user must make sure that the
       
    26 cleanup stack is created and a top-level TRAP marker is done.</note>
       
    27 <p>Hybrid application can also contain threads created using both <xref href="GUID-B0E661BC-4058-3256-B9C3-5A4FD52F6DE5.dita#GUID-B0E661BC-4058-3256-B9C3-5A4FD52F6DE5/GUID-6C840907-C3F7-34B7-97DB-CEDBA68EA277"><apiname>RThread::Create()</apiname></xref> and <codeph>pthread_create()</codeph>,
       
    28 and can still use P.I.P.S. APIs in both the threads. In case of <xref href="GUID-B0E661BC-4058-3256-B9C3-5A4FD52F6DE5.dita#GUID-B0E661BC-4058-3256-B9C3-5A4FD52F6DE5/GUID-6C840907-C3F7-34B7-97DB-CEDBA68EA277"><apiname>RThread::Create()</apiname></xref> the
       
    29 developer has to create cleanup stack and a top level TRAP for this thread
       
    30 in the thread entry Function, if it is required; else this thread may crash
       
    31 or panic. </p>
       
    32 <p>An application can have both C++ and C source codes. In this case, in order
       
    33 to give C linkage to C++ code- that is calling a function defined in a C++
       
    34 file that may have C++ code, use extern ā€œCā€. For example:</p>
       
    35 <codeblock xml:space="preserve">// File: sample.c
       
    36   void OtherFoo();
       
    37   
       
    38   void Foo() {
       
    39      OtherFoo();
       
    40   }
       
    41 
       
    42 // File: useme.cpp
       
    43   
       
    44   extern ā€œCā€ {
       
    45   void OtherFoo() {
       
    46      //Can use any C++ code here
       
    47      //Can use Symbian C++ code here
       
    48   }
       
    49   }
       
    50 </codeblock>
       
    51 </conbody></concept>