Adaptation/GUID-D1C5BB01-6780-41D6-B47B-43D4C983B0B6.dita
changeset 15 307f4279f433
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Adaptation/GUID-D1C5BB01-6780-41D6-B47B-43D4C983B0B6.dita	Fri Oct 15 14:32:18 2010 +0100
@@ -0,0 +1,48 @@
+<?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 IMPORT_C in the declaration and EXPORT_C 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>
\ No newline at end of file