Last update March 7, 2012

Phobos /
Std Loader



std.loader - A platform-independent executable module loader

Author/Contact: Matthew Wilson ( http://synsoft.org/d.html, stlsoft ^at^ hotmail ^dot^ com)

Project Page: None at the moment.

Download URL: None. This will be included in the next release of Phobos.

Mailing list: None.

Summary:

Pure D implementation of a free-function API and wrapper auto class for dynamic loading of executable modules, and extraction of functions from them. The API manipulates HXModule handles, and consists of the following functions:

    HXModule ExeModule_Load(in char[] moduleName);

HXModule ExeModule_AddRef(in HXModule hModule);

void ExeModule_Release(inout HXModule hModule);

void *ExeModule_GetSymbol(inout HXModule hModule, in char[] symbolName);

char[] ExeModule_Error();

The auto class ExeModule provides the following methods:

// Construction

    this(in HXModule hModule, boolean bTakeOwnership);

this(char[] moduleName);

~this(); // Calls close

// Methods

    void close(); // Facilitates early close

void *getSymbol(in char[] symbolName); // Throws ExeModuleException if symbol not found

void *findSymbol(in char[] symbolName); // Returns NULL if symbol not found

// Properties

    HXModule Handle();

char[] Path();

Status: Win32 and Linux versions implemented. Waiting for Walter's inclusion in next Phobos.

In need of help?: Not at this stage, although comment on the API / class will be welcome.

Other People Comments:

  • As I personally like the coding sytle proposed at Digital Mars, that would start function names with lower-case letters, I'd like to ask: "Why do the ExeModule_ functions not follow that guideline?"
  • The ExeModule_ functions are placed in the std.loader module. So why are they prefixed with ExeModule_ like old-style C name-prefixes? I think we don't need them?
-- Marcus Perlick


FrontPage | News | TestPage | MessageBoard | Search | Contributors | Folders | Index | Help | Preferences | Edit

Edit text of this page (date of last change: March 7, 2012 20:41 (diff))