M E T A C A L L

M E T A C A L L

A library for providing inter-language foreign function interface calls

# Abstract **[METACALL](https://github.com/metacall/core)** is a library that allows calling functions, methods or procedures between programming languages. With **[METACALL](https://github.com/metacall/core)** you can transparently execute code from / to any programming language, for example, call TypeScript code from Rust. # Install MetaCall is a C plugin based library. This crate wraps the C library into Rust, so in order to make it work, you should install MetaCall binaries first ([click here](https://github.com/metacall/install) for installing it on other platforms): ``` sh curl -sL https://raw.githubusercontent.com/metacall/install/master/install.sh | sh ``` # Example `sum.ts` ``` javascript export function sum(a: number, b: number): number { return a + b; } ``` `main.rs` ``` rust use metacall::{switch, metacall, loaders}; fn main() { // Initialize Metacall at the top let _metacall = switch::initialize().unwrap(); // Load the file loaders::from_single_file("ts", "sum.ts").unwrap(); // Call the sum function let sum = metacall::("sum", [1.0, 2.0]).unwrap(); assert_eq!(sum, 3.0); } ```