Giter VIP home page Giter VIP logo

riverd-loader's Introduction

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

riverd-loader's People

Contributors

ljmf00 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.