Path: blob/main/test/core/EXPORTED_RUNTIME_METHODS.c
4150 views
/*1* Copyright 2017 The Emscripten Authors. All rights reserved.2* Emscripten is available under two separate licenses, the MIT license and the3* University of Illinois/NCSA Open Source License. Both these licenses can be4* found in the LICENSE file.5*/67#include <emscripten.h>89void waka(int x, int y, int z) {10EM_ASM({11out('received ' + [$0, $1, $2] + '.');12}, x, y, z);13}1415int main() {16EM_ASM({17#if EXPORTED18// test for additional things being exported19assert(Module['addFunction'], 'missing addFunction export');20assert(Module['lengthBytesUTF8'], 'missing lengthBytesUTF8 export');21Module['setTempRet0'](42);22assert(Module['getTempRet0']() == 42);23// the main test here24Module['dynCall']('viii', $0, [1, 4, 9]);25#else26// If 'ASSERTIONS' is enabled, these properties all exist, but with27// stubs that show a useful error if called. So it is only meaningful28// to check they don't exist when assertions are disabled.29if (!ASSERTIONS) {30assert(!Module['addFunction'], 'missing addFunction export');31assert(!Module['lengthBytesUTF8'], 'missing lengthBytesUTF8 export');32assert(!Module['dynCall'], 'missing dynCall export');33}34dynCall('viii', $0, [1, 4, 9]);35#endif36}, &waka);37}38394041