@needs_dlfcn
def test_dylink_spaghetti(self):
    self.dylink_test(main='\n      #include <stdio.h>\n      int main_x = 72;\n      extern int side_x;\n      int adjust = side_x + 10;\n      int *ptr = &side_x;\n      struct Class {\n        Class() {\n          printf("main init sees %d, %d, %d.\\n", adjust, *ptr, main_x);\n        }\n      };\n      Class cm;\n      int main() {\n        printf("main main sees %d, %d, %d.\\n", adjust, *ptr, main_x);\n        return 0;\n      }\n    ', side='\n      #include <stdio.h>\n      extern int main_x;\n      int side_x = -534;\n      int adjust2 = main_x + 10;\n      int *ptr2 = &main_x;\n      struct Class {\n        Class() {\n          printf("side init sees %d, %d, %d.\\n", adjust2, *ptr2, side_x);\n        }\n      };\n      Class cs;\n    ', expected=['side init sees 82, 72, -534.\nmain init sees -524, -534, 72.\nmain main sees -524, -534, 72.', 'main init sees -524, -534, 72.\nside init sees 82, 72, -534.\nmain main sees -524, -534, 72.'])
@needs_dlfcn
def test_dylink_spaghetti(self):
    self.dylink_test(main='\n      #include <stdio.h>\n      int main_x = 72;\n      extern int side_x;\n      int adjust = side_x + 10;\n      int *ptr = &side_x;\n      struct Class {\n        Class() {\n          printf("main init sees %d, %d, %d.\\n", adjust, *ptr, main_x);\n        }\n      };\n      Class cm;\n      int main() {\n        printf("main main sees %d, %d, %d.\\n", adjust, *ptr, main_x);\n        return 0;\n      }\n    ', side='\n      #include <stdio.h>\n      extern int main_x;\n      int side_x = -534;\n      int adjust2 = main_x + 10;\n      int *ptr2 = &main_x;\n      struct Class {\n        Class() {\n          printf("side init sees %d, %d, %d.\\n", adjust2, *ptr2, side_x);\n        }\n      };\n      Class cs;\n    ', expected=['side init sees 82, 72, -534.\nmain init sees -524, -534, 72.\nmain main sees -524, -534, 72.', 'main init sees -524, -534, 72.\nside init sees 82, 72, -534.\nmain main sees -524, -534, 72.'])