+ DEBUG("Freed WIMStruct");
+}
+
+static bool test_locale_ctype_utf8()
+{
+ char *ctype = nl_langinfo(CODESET);
+
+ return (strstr(ctype, "UTF-8") == 0 ||
+ strstr(ctype, "UTF8") == 0 ||
+ strstr(ctype, "utf8") == 0 ||
+ strstr(ctype, "utf-8") == 0);
+}
+
+bool wimlib_mbs_is_utf8;
+
+/* Get global memory allocations out of the way. Not strictly necessary in
+ * single-threaded programs like 'imagex'. */
+WIMLIBAPI int
+wimlib_global_init()
+{
+ libxml_global_init();
+#ifdef WITH_NTFS_3G
+ libntfs3g_global_init();
+#endif
+ wimlib_mbs_is_utf8 = test_locale_ctype_utf8();
+ return 0;
+}
+
+/* Free global memory allocations. Not strictly necessary if the process using
+ * wimlib is just about to exit (as is the case for 'imagex'). */
+WIMLIBAPI void
+wimlib_global_cleanup()
+{
+ libxml_global_cleanup();
+ iconv_global_cleanup();