Am 06.01.2020 um 00:23 schrieb Oleg B:
It's analog of bindbc, but without need write boilerplate code.
May be bindbc is designed for another cases, but I don't understand need writing triple definition for one function (pointer, loading, wrap-function). ssll betterC compatible too, and tested on windows (x86) and linux (x86, ARM).

package: http://code.dlang.org/packages/ssll
github: https://github.com/deviator/ssll

Example usage:

Mosquitto binding and wrapper
https://github.com/deviator/mosquittod/blob/master/source/mosquittod/api/load.d

libsystemd binding
https://github.com/deviator/sdutil/blob/master/source/systemd/daemon.d

I think somebody can find it handy.

Just throwing this in as a possible API alternative/addition - I've written something similar with the goal to make it work transparently with existing static bindings: https://code.dlang.org/packages/dynamic

It uses a mixin to specify the module(s) containing the declarations instead of a UDA:


mixin dynamicBinding!(somelib) _somelib;

void main()
{
    _somelib.loadBinding(["somelib.so"]);

    import somelib : foo;
    foo();
}

Reply via email to