From: Magnus Jacobsson Date: Mon, 26 Jul 2021 12:44:47 +0000 (+0200) Subject: gvc: unify diverged storage-class attributes in gvc.h X-Git-Tag: 3.0.0~114^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f9326c1fc3b99c833189c0fd43f1e634aa3e1462;p=graphviz gvc: unify diverged storage-class attributes in gvc.h 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. --- diff --git a/lib/gvc/gvc.h b/lib/gvc/gvc.h index 2f975160a..850b20ff2 100644 --- a/lib/gvc/gvc.h +++ b/lib/gvc/gvc.h @@ -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