daplt 1.0.1

D wrapper to Plutonium C API


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:

daplt

D Language wrapper to Plutonium for creating modules.

Getting Started

Add to project using:

dub add daplt

and create an extern (C) init and unload function like:

import daplt.daplt;
import core.runtime;
extern (C) PObj init(){
	Runtime.initialize;
	return moduleCreate!(mixin(__MODULE__))("moduleName").obj;
}
extern (C) void unload(){
	Runtime.terminate;
}

Exporting Functions

Use the @PExport attribute with a function definition to export it:

@PExport string concat(string a, string b){
	return a ~ b;
}

daplt will handle the type conversion checks, default parameters, and conversion of return type.

Data Types

Use PObj.get!DType to get D type value from a Plutonium value. This can throw a DapltException since actual type of PObj cannot be determined at compile time.

Use DValue.to!PObj to get a Plutonium value from a D value. This can result in a static assert(false) if the source data type is not supported.

Plutonium TypeD Type
Intint
Int64long
Boolbool
Strstring
Floatdouble
Ptrvoid*
Ptrvoid*
DictPDict
ByteArrPBArray
ListPList
ModulePModule
Class or KlassPClass
ObjPClassObj
Func or NativeFuncPCallable

See source.daplt.daplt for documentation on PList, PClass, PClassObj, and PCallable

Authors:
  • nafees
Dependencies:
none
Versions:
1.0.1 2023-Sep-14
1.0.0 2023-Sep-05
~master 2023-Nov-01
Show all 3 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 2 downloads this month

  • 12 downloads total

Score:
0.5
Short URL:
daplt.dub.pm