@needs_dlfcn
def test_dlfcn_self(self):
    self.set_setting('MAIN_MODULE')
    self.set_setting('EXPORT_ALL')
    self.emcc_args.append('-nostdlib++')

    def post(filename):
        js = open(filename).read()
        start = js.find('var NAMED_GLOBALS')
        first = js.find('{', start)
        last = js.find('}', start)
        exports = js[(first + 1):last]
        exports = exports.split(',')
        exports = [e.split(':')[0].strip('"') for e in exports]
        exports.sort()
        self.assertGreater(len(exports), 20)
        if self.is_wasm_backend():
            self.assertLess(len(exports), 56)
        else:
            self.assertLess(len(exports), 33)
    self.do_run_in_out_file_test('tests', 'core', 'test_dlfcn_self', post_build=post)
@needs_dlfcn
def test_dlfcn_self(self):
    self.set_setting('MAIN_MODULE')
    self.set_setting('EXPORT_ALL')
    self.emcc_args.append('-nostdlib++')

    def post(filename):
        js = open(filename).read()
        start = js.find('var NAMED_GLOBALS')
        first = js.find('{', start)
        last = js.find('}', start)
        exports = js[(first + 1):last]
        exports = exports.split(',')
        exports = [e.split(':')[0].strip('"') for e in exports]
        exports.sort()
        self.assertGreater(len(exports), 20)
        if self.is_wasm_backend():
            self.assertLess(len(exports), 56)
        else:
            self.assertLess(len(exports), 33)
    self.do_run_in_out_file_test('tests', 'core', 'test_dlfcn_self', post_build=post)