diff -r 578be2adaf3e -r 307f4279f433 Adaptation/GUID-D1C5BB01-6780-41D6-B47B-43D4C983B0B6.dita --- /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 @@ + + + + + +API ExportThis document discusses how to export a device driver API. +

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 .def file. The .def file is specific +to the platform to which the driver is built.

+// 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->MyExAPI(); + … + } +

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 Handler Implementation for more information on this.

+
\ No newline at end of file