@needs_dlfcn
def test_dylink_global_var_jslib(self):
    create_test_file('lib.js', "\n      mergeInto(LibraryManager.library, {\n        jslib_x: '{{{ makeStaticAlloc(4) }}}',\n        jslib_x__postset: 'HEAP32[_jslib_x>>2] = 148;',\n      });\n    ")
    self.dylink_test(main='\n      #include <stdio.h>\n      extern "C" int jslib_x;\n      extern void call_side();\n      int main() {\n        printf("main: jslib_x is %d.\\n", jslib_x);\n        call_side();\n        return 0;\n      }\n    ', side='\n      #include <stdio.h>\n      extern "C" int jslib_x;\n      void call_side() {\n        printf("side: jslib_x is %d.\\n", jslib_x);\n      }\n    ', expected=['main: jslib_x is 148.\nside: jslib_x is 148.\n'], main_emcc_args=['--js-library', 'lib.js', '-s', 'EXPORTED_FUNCTIONS=["_main", "_jslib_x"]'])
@needs_dlfcn
def test_dylink_global_var_jslib(self):
    create_test_file('lib.js', "\n      mergeInto(LibraryManager.library, {\n        jslib_x: '{{{ makeStaticAlloc(4) }}}',\n        jslib_x__postset: 'HEAP32[_jslib_x>>2] = 148;',\n      });\n    ")
    self.dylink_test(main='\n      #include <stdio.h>\n      extern "C" int jslib_x;\n      extern void call_side();\n      int main() {\n        printf("main: jslib_x is %d.\\n", jslib_x);\n        call_side();\n        return 0;\n      }\n    ', side='\n      #include <stdio.h>\n      extern "C" int jslib_x;\n      void call_side() {\n        printf("side: jslib_x is %d.\\n", jslib_x);\n      }\n    ', expected=['main: jslib_x is 148.\nside: jslib_x is 148.\n'], main_emcc_args=['--js-library', 'lib.js', '-s', 'EXPORTED_FUNCTIONS=["_main", "_jslib_x"]'])