ddl.DynamicLibrary

Authors:
Eric Anderton, Don Clugston

License:
BSD Derivative (see source for details)

class DynamicLibrary;
Abstract base class for all DynamicLibrary types for use with DDL.

ExportSymbol * getSymbol(char[] name);
Returns:
an export for the requested symbol name. Will throw if the symbol does not exist.

DynamicModule[] getModules();
Returns:
all the modules controled by this library.

char[] getType();
This provides a means to identify what type of library is being used here. The string returned matches the string returned by the DymamicLibraryLoader that created the library. See getLibraryType() for more information.

Returns:
the type of library.

char[][char[]] getAttributes();
Returns:
the attributes for this library.

DynamicModule getModuleForSymbol(char[] name);
The getModuleForSymbol() method provides a way for DymamicLibrary implementations to implement conservative loading of modules when a link operation is in progress. The linker uses this method to get a module for a given export name, and then processes the link operation against the module returned.

The behavior of this method is in sharp contrast to the getModules() method, which forces the implementation to return every and all modules it controls, without exception.

In light of that, Relying on the getModules() (and getSymbols()) methods can have serious performance implications, depending on the actual implemenation of DynamicLibrary. For example, some implementations may decide to intercept D symbols and map the symbol namespace onto an internal lookup scheme or a file tree. Others, may use an internal cache for modules or implement some variation of lazy-loading.

Returns:
the module contianing the export, or null if no module in this library contains the export. The module is not guaranteed to contain the symbol provided, and can simply be the library's best guess as to a match. Call getSymbol() on the returned module to eliminate any such false-positives.

char[] name the name of the symbol to find a module match for.


ubyte[] getResource(char[] name);
The use of the getResource method is primarily to support resource loading on .zip style collections. Its behavior is very implementation dependent, but it can be reliably expected to return null if a resource cannot be reproduced.

Returns:
the requested resource, or null if it does not exist.

char[] name the name of the symbol to search for.


template getClassInfo(char[] classname)
Template method that returns a ClassInfo instance for the given classname.

Returns:
a ClassInfo instance for classname, or null if none exists.

classname the D namespace and name of the class to search for.


template getCtor(TInterface,char[] classname)
TInterface function(P1) getCtor!(TInterface, classname, P1);

Returns a function which constructs a class, using the given parameters. For example:
  auto newFoo = getCtor("FooModule.Foo", char [], real);
  auto newFooI = getCtor("FooModule.Foo", int);
  x = newFooI(58);
  y = newFoo("Avogadro's Number", 6.022e23);
is equivalent to:
  x = new FooModule.Foo(58);
  y = new FooModule.Foo("Avogadro's Number", 6.022e23);