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 Type | D Type |
---|---|
Int | int |
Int64 | long |
Bool | bool |
Str | string |
Float | double |
Ptr | void* |
Ptr | void* |
Dict | PDict |
ByteArr | PBArray |
List | PList |
Module | PModule |
Class or Klass | PClass |
Obj | PClassObj |
Func or NativeFunc | PCallable |
See source.daplt.daplt
for documentation on PList
, PClass
, PClassObj
,
and PCallable
- 1.0.1 released a year ago
- Nafees10/daplt
- MIT
- Copyright © 2023, nafees
- Authors:
- Dependencies:
- none
- Versions:
-
1.0.1 2023-Sep-14 1.0.0 2023-Sep-05 ~master 2023-Nov-01 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
12 downloads total
-
- Score:
- 0.5
- Short URL:
- daplt.dub.pm