metacall 0.0.3
A library for providing inter-language foreign function interface calls
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:
M E T A C A L L
A library for providing inter-language foreign function interface calls
Abstract
METACALL is a library that allows calling functions, methods or procedures between programming languages. With METACALL you can transparently execute code from / to any programming language, for example, call Python code from NodeJS.
Install
Install MetaCall binaries first (click here for additional info about the install script):
bash <(curl -sL https://raw.githubusercontent.com/metacall/install/master/install.sh)
Then install MetaCall Dub package:
dub add metacall
Example
sum.py
def sum(a, b):
return a + b
main.d
import std.stdio;
import std.variant;
import metacall; // Import MetaCall
int main()
{
dmetacall_initialize();
string[] scripts = [
"script.py"
];
dmetacall_load_from_file("py",scripts);
Variant ret = dmetacall!(int,int)("add",1,2);
writefln("add(1,2) = %d",ret.get!(long)); // 3
dmetacall_destroy();
return 0;
}
Testing
In order to test you'll have to run dub add-local ..
in the test folder.
- Registered by Vicente Eduardo Ferrer Garcia
- 0.0.3 released 4 years ago
- metacall/dlang-port
- metacall.io
- Apache 2.0
- Copyright (C) 2016 - 2020 Vicente Eduardo Ferrer Garcia <[email protected]>
- Authors:
- Dependencies:
- none
- Versions:
-
0.0.3 2020-Aug-04 0.0.2 2020-Aug-04 0.0.1 2020-Aug-04 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
16 downloads total
-
- Score:
- 0.9
- Short URL:
- metacall.dub.pm