Symbian3/PDK/Source/GUID-D1C5BB01-6780-41D6-B47B-43D4C983B0B6.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Thu, 11 Mar 2010 18:02:22 +0000
changeset 3 46218c8b8afa
parent 1 25a17d01db0c
child 5 f345bda72bc4
permissions -rw-r--r--
week 10 bug fix submission (SF PDK version): Bug 1892, Bug 1897, Bug 1319. Also 3 or 4 documents were found to contain code blocks with SFL, which has been fixed. Partial fix for broken links, links to Forum Nokia, and the 'Symbian platform' terminology issues.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<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>
<p>A driver can export its API to be used by other Kernel code by using <codeph>EXPORT_C</codeph> in
the declaration and <codeph>IMPORT_C</codeph> in the definition. When the
driver is built, these functions are exported to a <filepath>.def</filepath> file.
The <filepath>.def</filepath> file is specific to the platform to which the
driver is built. </p>
<codeblock id="GUID-3E732A29-D285-5A51-AF25-9B4B06049632" xml:space="preserve">// Kernel extension internal API
class DExController: public DBase
    {

    void MyExAPI();

    };

// Client interface API
class TExClientInterface
    {

    // static function being exported, this API will go into def file 
    // generated while building
    IMPORT_C static void MyExAPI();

    };

// Global instance of the object
DExController *ExController = NULL; 

// Implementation of the kernel extension's exported function
EXPORT_C void TExClientInterface::MyExAPI()
    {

    ExController-&gt;MyExAPI();

    }</codeblock>
<p>Kernel extensions can also provide information to user programs by setting
attributes that can be read through the system HAL (Hardware Abstration Layer)
API. See<xref href="GUID-124AC7EE-E227-5358-A755-628FFE257250.dita"> Handler Implementation</xref> for
more information on this. </p>
</conbody></concept>