Adaptation/GUID-D1C5BB01-6780-41D6-B47B-43D4C983B0B6.dita
changeset 15 307f4279f433
equal deleted inserted replaced
14:578be2adaf3e 15:307f4279f433
       
     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-D1C5BB01-6780-41D6-B47B-43D4C983B0B6" xml:lang="en"><title>API Export</title><shortdesc>This document discusses how to export a device driver API.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    13 <p>A driver can export its API to be used by other Kernel code by
       
    14 using IMPORT_C in the declaration and EXPORT_C in the definition.
       
    15 When the driver is built, these functions are exported to a <filepath>.def</filepath> file. The <filepath>.def</filepath> file is specific
       
    16 to the platform to which the driver is built. </p>
       
    17 <codeblock id="GUID-3E732A29-D285-5A51-AF25-9B4B06049632" xml:space="preserve">// Kernel extension internal API
       
    18 class DExController: public DBase
       
    19     {
       
    20
       
    21     void MyExAPI();
       
    22
       
    23     };
       
    24 
       
    25 // Client interface API
       
    26 class TExClientInterface
       
    27     {
       
    28
       
    29     // static function being exported, this API will go into def file 
       
    30     // generated while building
       
    31     IMPORT_C static void MyExAPI();
       
    32
       
    33     };
       
    34 
       
    35 // Global instance of the object
       
    36 DExController *ExController = NULL; 
       
    37 
       
    38 // Implementation of the kernel extension's exported function
       
    39 EXPORT_C void TExClientInterface::MyExAPI()
       
    40     {
       
    41
       
    42     ExController-&gt;MyExAPI();
       
    43
       
    44     }</codeblock>
       
    45 <p>Kernel extensions can also provide information to user programs
       
    46 by setting attributes that can be read through the system HAL (Hardware
       
    47 Abstration Layer) API. See<xref href="GUID-124AC7EE-E227-5358-A755-628FFE257250.dita"> Handler Implementation</xref> for more information on this. </p>
       
    48 </conbody></concept>