Skip to content

Use __declspec(dllexport) to export symbols as far as possible

Chun-wei Fan requested to merge cogl.dllexport into cogl-1.22

Hi,

This updates the public headers to export the public symbols on Visual Studio builds using __declspec(dllexport), when Cogl is being built as a DLL, as well as some of the internal private variables that Cogl-Path and Cogl-Pango need to refer from the main Cogl DLL. For the existing deprecation macros, they have also been updated to use this mechanism as well, in addition to the existing functionality of warning of deprecated code usage.

This will reduce the maintenance burden on cogl.symbols (intentionally kept as there are some private API calls into Cogl that we want to eventually remove from Cogl-Path and Cogl-Pango), and will remove cogl-path.symbols and cogl-pango.symbols, as we could use compiler directives to tell the linker to export the symbols.

This will also fix running Cogl-Path and Cogl-Pango on Visual Studio DLL builds as the extern variables (which we must also export) in cogl-debug.h need to be referred to with __declspec(dllimport) so that they are referred to properly without crashing the programs that use them. This is moved to MR !6.

p.s. As cogl.symbols is being kept around, I did not do what is now done in Clutter, GLib and GTK to define a macro for non-Visual Studio builds to export symbols there, as I am clearly not someone that knows about how things go on those platforms.

With blessings, thank you!

Edited by Chun-wei Fan

Merge request reports