More specifically, add support for the dllexport storage-class
attribute for all build systems under Windows, MinGW and Cygwin.
This will allow removing the gvc.h symbols from the gvc.def file in an
upcoming commit.
This change makes the gvc.h file conform to
https://gitlab.com/graphviz/graphviz/-/issues/2058#note_678679545.
This file had one set of Windows-specific storage-class attribute
declarations intended for use with the autotools build system and one
set intended for use with Visual Studio, with slightly different
control mechanisms.
It's unclear what effect changes made to these control mechanisms over
the years has had on the many operating systems that are not tested in
CI. The current state is that they partly overlap and are very hard to
understand.
This commit cleans this up by applying such declarations only if the
GVDLL or symbol is set. An export declaration is used if the
GVC_EXPORT symbol is defined and an import declaration otherwise.
Towards https://gitlab.com/graphviz/graphviz/-/issues/2058.
#endif
#ifdef GVDLL
+#ifdef GVC_EXPORTS
#define GVC_API __declspec(dllexport)
#else
-#define GVC_API
-#endif
-
-/*visual studio*/
-#ifdef _WIN32
-#ifndef GVC_EXPORTS
-#undef GVC_API
#define GVC_API __declspec(dllimport)
#endif
#endif
-/*end visual studio*/
+
#ifndef GVC_API
#define GVC_API extern
#endif