@needs_dlfcn
@with_both_exception_handling
def test_dylink_raii_exceptions(self):
    self.dylink_test(main='\n      #include <stdio.h>\n      extern int side();\n      int main() {\n        printf("from side: %d.\\n", side());\n      }\n    ', side='\n      #include <stdio.h>\n      typedef int (*ifdi)(float, double, int);\n      int func_with_special_sig(float a, double b, int c) {\n        printf("special %f %f %d\\n", a, b, c);\n        return 1337;\n      }\n      struct DestructorCaller {\n        ~DestructorCaller() { printf("destroy\\n"); }\n      };\n      int side() {\n        // d has a destructor that must be called on function\n        // exit, which means an invoke will be used for the\n        // indirect call here - and the signature of that call\n        // is special and not present in the main module, so\n        // it must be generated for the side module.\n        DestructorCaller d;\n        volatile ifdi p = func_with_special_sig;\n        return p(2.18281, 3.14159, 42);\n      }\n    ', expected=['special 2.182810 3.141590 42\ndestroy\nfrom side: 1337.\n'])
@needs_dlfcn
@with_both_exception_handling
def test_dylink_raii_exceptions(self):
    self.dylink_test(main='\n      #include <stdio.h>\n      extern int side();\n      int main() {\n        printf("from side: %d.\\n", side());\n      }\n    ', side='\n      #include <stdio.h>\n      typedef int (*ifdi)(float, double, int);\n      int func_with_special_sig(float a, double b, int c) {\n        printf("special %f %f %d\\n", a, b, c);\n        return 1337;\n      }\n      struct DestructorCaller {\n        ~DestructorCaller() { printf("destroy\\n"); }\n      };\n      int side() {\n        // d has a destructor that must be called on function\n        // exit, which means an invoke will be used for the\n        // indirect call here - and the signature of that call\n        // is special and not present in the main module, so\n        // it must be generated for the side module.\n        DestructorCaller d;\n        volatile ifdi p = func_with_special_sig;\n        return p(2.18281, 3.14159, 42);\n      }\n    ', expected=['special 2.182810 3.141590 42\ndestroy\nfrom side: 1337.\n'])