dlibloader 0.0.6

D library that loads dynamic libraries on Windows, Linux, and macOS


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:

DLibLoader

D library that loads dynamic libraries on Windows, Linux, and macOS. Based on this C++ library: https://github.com/craftablescience/LibLoader

General usage

import std.stdio;
import std.typecons;
import libloader;

void main() {
	// You don't need to specify the extension .dll, .so, or .dylib, but you can
	library lib = library( "path/to/library", ".dll" );
	
	if ( lib.isLoaded() ) {
		if ( lib.callC!(void)( "MyCoolCFun" ) ) {
			writeln( "Success" );
		}
		else {
			writeln( "Failed" );
		}

		Nullable!float result = lib.callC!(float)( "MyCoolFloatCFun" );
		if ( result.isNull() ) {
			writeln( "Failed" );
		}
		else {
			writeln( result.get() );
		}
	}
}
Authors:
  • Spirrwell
Dependencies:
none
Versions:
0.0.6 2023-Jul-24
0.0.5 2023-Jul-23
0.0.4 2023-Jul-23
0.0.3 2023-Jul-23
0.0.2 2023-Jul-23
Show all 7 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 47 downloads total

Score:
0.6
Short URL:
dlibloader.dub.pm