module watt.library

Load functions from shared objects.

Code Map

//! Load functions from shared objects.
module watt.library;


//! A delegate that loads an address from a name. Usually loads a
//! function.
alias Loader = void* delegate(string);

//! Represents a loadable module.
class Library
{
public:
	//! Return a pointer to the requested symbol name.
	fn symbol(symbol: string) void* { }
	//! Close the library.
	fn free() { }


public:
	//! Given a list of shared objects, return the first one that loads.
	static fn loads(files: string[]) Library { }
	//! Create a Library from a path to a shared object.
	static fn load(filename: string) Library { }
}
alias Loader

A delegate that loads an address from a name. Usually loads a function.

class Library

Represents a loadable module.

fn loads(files: string[]) Library

Given a list of shared objects, return the first one that loads.

Parameters

files

A list of shared objects to try and open.

Return

A Library instance from the first element of files that loads, or null if every element failed to load.

fn load(filename: string) Library

Create a Library from a path to a shared object.

fn symbol(symbol: string) void*

Return a pointer to the requested symbol name.

fn free()

Close the library.