riverd-loader 1.0.2

A cross-platform betterC compatible shared library loader for D bindings


To use this package, run the following command in your project's root directory:

RiverD Loader

A cross-platform betterC compatible shared library loader for D bindings

RiverD is a project to create static and dynamic binds to all C libraries. The intent is to make a standard loader and allow users to use or not -betterC, @nogc or even nothrow.

Use RiverD

How to create a RiverD bind

At the moment, our mixin builder don't support -betterC, so you need to make it manually (D compilers can't evaluate CTFE with GC dependent code using -betterC).

Using RiverD builder, you need to specify a types module containing all the types to be used on your C functions, a dynfun module containing __gshared symbols and import to types (for function types), a dynload module containing the import of dynfun module and this piece of code:

mixin(DylibLoaderBuilder!(dynfun));

Additionally, you have statfun module for static linkage support containing extern(C) functions declarations.

Using RiverD loader manually you can adapt this code for dynload module:

void* dylib_load_libname() {
	void* handle = dylib_load("libname.so");
	if(handle is null) return null;

	dylib_bindSymbol(handle, cast(void**)&libname_symbol, "libname_symbol"); //make this for every function symbol

	return handle;
}

How to load/unload a bind

void* libname_handle = dylib_load_libname(); // load
dylib_unload(libname_handle); // unload
bool loaded = dylib_is_loaded(libname_handle); // isloaded

How to contribute

Check out our wiki.

License

GNU Lesser General Public License (Version 3, 29 June 2007)

Made with ❤ by a bunch of geeks

License Discord Server

Authors:
  • Luís Ferreira
Dependencies:
none
Versions:
1.0.2 2019-Apr-29
~master 2019-Apr-29
~wip-documentation 2019-Apr-29
Show all 3 versions
Download Stats:
  • 0 downloads today

  • 49 downloads this week

  • 523 downloads this month

  • 1127 downloads total

Score:
2.3
Short URL:
riverd-loader.dub.pm