Fix symbol visibility macros on Windows

There is currently no `dllimport` attribute on any of our function,
which prevents MSVC to optimize function calls.

To fix that issue, we need to redeclare all our visibility macros for
each of our libraries, because when compiling e.g. GIO code, we need
dllimport in GLIB headers and dllexport in GIO headers. That means they
cannot use the same GLIB_AVAILABLE_* macro.

Since that's a lot of boilerplate to copy/paste after each version bump,
this MR generate all those macros using a python script.

Also simplify the meson side by using `gnu_symbol_visibility : 'hidden'`
keyword argument instead of passing the cflag manually.

This leaves only API index to add manually into glib-docs.xml when
bumping GLib version. That file cannot be generated because Meson does
not allow passing a buit file to gnome.gtkdoc()'s main_xml kwarg
unfortunately.
This commit is contained in:
Xavier Claessens
2022-10-03 10:36:04 -04:00
parent d40459c280
commit dcfc9f689e
30 changed files with 409 additions and 1655 deletions

View File

@@ -185,9 +185,6 @@ G_TYPE_RESERVED_GLIB_LAST
G_TYPE_RESERVED_BSE_FIRST
G_TYPE_RESERVED_BSE_LAST
G_TYPE_RESERVED_USER_FIRST
<SUBSECTION Private>
GOBJECT_VAR
</SECTION>
<SECTION>

View File

@@ -8,6 +8,7 @@ if get_option('gtk_doc')
'gobject_trace.h',
'gtype-private.h',
'glib-enumtypes.h',
'gobject-visibility.h',
]
docpath = join_paths(glib_datadir, 'gtk-doc', 'html')
@@ -28,7 +29,8 @@ if get_option('gtk_doc')
dependencies : [libgobject_dep, libglib_dep],
include_directories : [gtkdocincl],
src_dir : 'gobject',
scan_args : gtkdoc_common_scan_args + [
scan_args : [
'--ignore-decorators=' + '|'.join(ignore_decorators.replace('GLIB', 'GOBJECT')),
'--rebuild-types',
'--ignore-headers=' + ' '.join(ignore_headers),
],