@needs_dlfcn
@bleeding_edge_wasm_backend
def test_dlfcn_feature_in_lib(self):
    self.emcc_args.append('-mnontrapping-fptoint')
    self.prep_dlfcn_lib()
    lib_src = '\n        extern "C" int magic(float x) {\n          return __builtin_wasm_trunc_saturate_s_i32_f32(x);\n        }\n      '
    dirname = self.get_dir()
    filename = os.path.join(dirname, 'liblib.cpp')
    self.build_dlfcn_lib(lib_src, dirname, filename)
    self.prep_dlfcn_main()
    src = '\n      #include <dlfcn.h>\n      #include <stdio.h>\n      #include <stdlib.h>\n\n      typedef int (*fi)(float);\n\n      int main() {\n        void *lib_handle = dlopen("liblib.so", 0);\n        if (!lib_handle) {\n          puts(dlerror());\n          abort();\n        }\n        fi x = (fi)dlsym(lib_handle, "magic");\n        if (!x) {\n          puts(dlerror());\n          abort();\n        }\n        printf("float: %d.\\n", x(42.99));\n        return 0;\n      }\n      '
    self.do_run(src, 'float: 42.\n')
@needs_dlfcn
@bleeding_edge_wasm_backend
def test_dlfcn_feature_in_lib(self):
    self.emcc_args.append('-mnontrapping-fptoint')
    self.prep_dlfcn_lib()
    lib_src = '\n        extern "C" int magic(float x) {\n          return __builtin_wasm_trunc_saturate_s_i32_f32(x);\n        }\n      '
    dirname = self.get_dir()
    filename = os.path.join(dirname, 'liblib.cpp')
    self.build_dlfcn_lib(lib_src, dirname, filename)
    self.prep_dlfcn_main()
    src = '\n      #include <dlfcn.h>\n      #include <stdio.h>\n      #include <stdlib.h>\n\n      typedef int (*fi)(float);\n\n      int main() {\n        void *lib_handle = dlopen("liblib.so", 0);\n        if (!lib_handle) {\n          puts(dlerror());\n          abort();\n        }\n        fi x = (fi)dlsym(lib_handle, "magic");\n        if (!x) {\n          puts(dlerror());\n          abort();\n        }\n        printf("float: %d.\\n", x(42.99));\n        return 0;\n      }\n      '
    self.do_run(src, 'float: 42.\n')