Skip to content

Instantly share code, notes, and snippets.

@kripken
Created June 17, 2013 01:41
Show Gist options
  • Save kripken/5794193 to your computer and use it in GitHub Desktop.
Save kripken/5794193 to your computer and use it in GitHub Desktop.
diff --git a/tests/runner.py b/tests/runner.py
index 73dbab1..dc3f721 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -9009,6 +9009,32 @@ def process(filename):
'''
self.do_run(src, 'abs(-10): 10\nabs(-11): 11');
+ def test_embind2jslib(self):
+ if self.emcc_args is None: return self.skip('requires emcc')
+ Building.COMPILER_TEST_OPTS += ['--bind', '--js-library', 'lib.js']
+
+ open('lib.js', 'w').write('''
+ mergeInto(LibraryManager.library, {
+ c_func: function() { Module.print('hello embind, i am a js lib') }
+ });
+ ''')
+
+ src = r'''
+ #include<stdio.h>
+ #include<emscripten/val.h>
+
+ using namespace emscripten;
+
+ extern "C" { void c_func(); }
+
+ int main() {
+ val the_c_func = val::fromJS(c_func);
+ the_c_func();
+ return 0;
+ }
+ '''
+ self.do_run(src, 'hello embind, i am a js lib');
+
def test_scriptaclass(self):
if self.emcc_args is None: return self.skip('requires emcc')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment