]> granicus.if.org Git - graphviz/commitdiff
gvc: unify diverged storage-class attributes in gvc.h
authorMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Mon, 26 Jul 2021 12:44:47 +0000 (14:44 +0200)
committerMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Wed, 22 Dec 2021 05:06:01 +0000 (06:06 +0100)
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.

lib/gvc/gvc.h

index 2f975160a50924ca86ba93e94ab0e9e389727e36..850b20ff2ef15c630fd8cd0273089956c3a37372 100644 (file)
@@ -20,19 +20,13 @@ extern "C" {
 #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