@needs_dlfcn
def test_dlfcn_i64(self):
    self.prep_dlfcn_lib()
    self.set_setting('EXPORTED_FUNCTIONS', ['_foo'])
    lib_src = '\n      int foo(int x) {\n        return (long long)x / (long long)1234;\n      }\n      '
    dirname = self.get_dir()
    filename = os.path.join(dirname, 'liblib.c')
    self.build_dlfcn_lib(lib_src, dirname, filename)
    self.prep_dlfcn_main()
    self.clear_setting('EXPORTED_FUNCTIONS')
    src = '\n      #include <stdio.h>\n      #include <stdlib.h>\n      #include <dlfcn.h>\n\n      typedef int (*intfunc)(int);\n\n      void *p;\n\n      int main() {\n        p = malloc(1024);\n        void *lib_handle = dlopen("liblib.so", 0);\n        if (!lib_handle) {\n          puts(dlerror());\n          abort();\n        }\n        printf("dll handle: %p\\n", lib_handle);\n        intfunc x = (intfunc)dlsym(lib_handle, "foo");\n        printf("foo func handle: %p\\n", x);\n        if (p == 0) return 1;\n        if (!x) {\n          printf("dlsym failed: %s\\n", dlerror());\n          return 1;\n        }\n        printf("|%d|\\n", x(81234567));\n        return 0;\n      }\n      '
    self.do_run(src, '|65830|')
@needs_dlfcn
def test_dlfcn_i64(self):
    self.prep_dlfcn_lib()
    self.set_setting('EXPORTED_FUNCTIONS', ['_foo'])
    lib_src = '\n      int foo(int x) {\n        return (long long)x / (long long)1234;\n      }\n      '
    dirname = self.get_dir()
    filename = os.path.join(dirname, 'liblib.c')
    self.build_dlfcn_lib(lib_src, dirname, filename)
    self.prep_dlfcn_main()
    self.clear_setting('EXPORTED_FUNCTIONS')
    src = '\n      #include <stdio.h>\n      #include <stdlib.h>\n      #include <dlfcn.h>\n\n      typedef int (*intfunc)(int);\n\n      void *p;\n\n      int main() {\n        p = malloc(1024);\n        void *lib_handle = dlopen("liblib.so", 0);\n        if (!lib_handle) {\n          puts(dlerror());\n          abort();\n        }\n        printf("dll handle: %p\\n", lib_handle);\n        intfunc x = (intfunc)dlsym(lib_handle, "foo");\n        printf("foo func handle: %p\\n", x);\n        if (p == 0) return 1;\n        if (!x) {\n          printf("dlsym failed: %s\\n", dlerror());\n          return 1;\n        }\n        printf("|%d|\\n", x(81234567));\n        return 0;\n      }\n      '
    self.do_run(src, '|65830|')