Created
November 9, 2016 18:58
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(link_args)] | |
#[link_args = "-s EXPORTED_FUNCTIONS=['_hello_world']"] | |
extern {} | |
extern crate semver; | |
use semver::Version; | |
use semver::VersionReq; | |
#[no_mangle] | |
pub fn hello_world() -> bool { | |
// let r = VersionReq::parse(">= 1.0.0").unwrap(); | |
// let v = Version::parse("1.0.0").unwrap(); | |
true | |
} | |
fn main() { | |
/* Intentionally left blank */ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Module = require("./main.js"); | |
var hello_world = Module.cwrap('hello_world', 'boolean', []); | |
var result = hello_world(); | |
console.log("result: ", result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment