@needs_dlfcn
def test_dlfcn_basic(self):
    self.prep_dlfcn_lib()
    lib_src = '\n      #include <cstdio>\n\n      class Foo {\n      public:\n        Foo() {\n          puts("Constructing lib object.");\n        }\n      };\n\n      Foo global;\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 <cstdio>\n      #include <dlfcn.h>\n\n      class Bar {\n      public:\n        Bar() {\n          puts("Constructing main object.");\n        }\n      };\n\n      Bar global;\n\n      int main() {\n        dlopen("liblib.so", RTLD_NOW);\n        return 0;\n      }\n      '
    self.do_run(src, 'Constructing main object.\nConstructing lib object.\n')
@needs_dlfcn
def test_dlfcn_basic(self):
    self.prep_dlfcn_lib()
    lib_src = '\n      #include <cstdio>\n\n      class Foo {\n      public:\n        Foo() {\n          puts("Constructing lib object.");\n        }\n      };\n\n      Foo global;\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 <cstdio>\n      #include <dlfcn.h>\n\n      class Bar {\n      public:\n        Bar() {\n          puts("Constructing main object.");\n        }\n      };\n\n      Bar global;\n\n      int main() {\n        dlopen("liblib.so", RTLD_NOW);\n        return 0;\n      }\n      '
    self.do_run(src, 'Constructing main object.\nConstructing lib object.\n')