metacall 0.0.2

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:

<div align="center"> <a href="https://metacall.io" target="_blank"><img src="https://raw.githubusercontent.com/metacall/core/master/deploy/images/logo.png" alt="M E T A C A L L" style="max-width:100%; margin: 0 auto;" width="80" height="80"> <p><b>M E T A C A L L</b></p></a> <p>A library for providing inter-language foreign function interface calls</p> </div>

Abstract

[METACALL](https://github.com/metacall/core) 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.

Authors:
  • Duxz
Dependencies:
none
Versions:
0.0.3 2020-Aug-04
0.0.2 2020-Aug-04
0.0.1 2020-Aug-04
Show all 3 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 1 downloads this month

  • 16 downloads total

Score:
0.9
Short URL:
metacall.dub.pm