riverd-core 1.0.1

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:

Manual usage
Put the following dependency into your project's dependences section:

RiverD Core

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.1 2019-Feb-15
1.0.0 2019-Feb-15
~master 2019-Apr-15
~wip-documentation 2019-Apr-15
~wip-ci 2019-Apr-14
Show all 5 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 5253 downloads total

Score:
0.6
Short URL:
riverd-core.dub.pm