Skip to content
  • Allison Karlitskaya's avatar
    win32: Drop old codepage ABI from gutils.c · 8c42a663
    Allison Karlitskaya authored
    This is a source-compatible change and only breaks ABI with respect to
    truly ancient binaries (and those binaries are already broken for other
    reasons).
    
    Back in the day, functions like g_get_user_name() used to return strings
    in the system codepage instead of utf8 (as they do today).
    
    It was decided at some point to change these functions to return utf8,
    breaking source compatibility but keeping ABI compatibility.  This was
    done by exporting new symbols with names like g_get_user_name_utf8() and
    using a #define of the old name over to the new name (so that newly
    compiled code would link against the _utf8 version, but old binaries
    would continue to use the non-utf8 variant).
    
    Meanwhile, glib has undergone several ABI breaks on Windows since, so
    those old binaries don't work anymore.
    
    Start to clean up this mess by removing the #define renaming.  New
    binaries calling g_get_user_name() will now link against
    g_get_user_name() and it will return utf8.
    
    We must keep the functions like g_get_user_name_utf8() for binary
    compatibility with recently built programs (ie: ones built with the
    renaming).  Nobody should have ever been calling these directly and of
    course they can return utf8, so just add them as internal wrappers in the
    .c file and declare them _GLIB_EXTERN there.
    
    One day, if we feel like breaking Windows ABI again, we can finish the
    cleanup by dropping the wrappers.  There is some talk of introducing
    something like 'ABI compatible for two years' and this change would be
    compatible with such a regime.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=693204
    8c42a663