From: Magnus Jacobsson Date: Mon, 19 Apr 2021 20:35:42 +0000 (+0200) Subject: Correct MSVC storage-class in gvpr.h. Removes one warning X-Git-Tag: 2.47.2~3^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7de22e0fa334590fb642c215400607a8557ebb35;p=graphviz Correct MSVC storage-class in gvpr.h. Removes one warning Only set __declspec(dllexport) or __declspec(dllimport) when the gvpr library is dynamically linked. This is defined by GVDLL which is set in the Windows MSBuild builds which use dynamic linking, but unset in the Windows CMake builds which use static linking. Removes the following warning from the Windows CMake builds: C:\GitLab-Runner\builds\graphviz\graphviz\lib\gvpr\gvpr.c(931,1): warning C4273: 'gvpr': inconsistent dll linkage [C:\GitLab-Runner\builds\graphviz\graphviz\build\lib\gvpr\gvpr.vcxproj] --- diff --git a/lib/gvpr/gvpr.h b/lib/gvpr/gvpr.h index 7a42f0188..922016b4d 100644 --- a/lib/gvpr/gvpr.h +++ b/lib/gvpr/gvpr.h @@ -16,13 +16,17 @@ extern "C" { #define GVPR_H #ifdef _WIN32 -# ifdef EXPORT_GVPR -# define GVPR_API __declspec(dllexport) -# else -# define GVPR_API __declspec(dllimport) +# ifdef GVDLL +# ifdef EXPORT_GVPR +# define GVPR_API __declspec(dllexport) +# else +# define GVPR_API __declspec(dllimport) +# endif # endif -#else -# define GVPR_API extern +#endif + +#ifndef GVPR_API +# define GVPR_API /* nothing */ #endif #include "cgraph.h" @@ -61,7 +65,7 @@ typedef struct { gvprbinding* bindings; /* array of bindings, terminated with {NULL,NULL} */ } gvpropts; -GVPR_API int gvpr (int argc, char *argv[], gvpropts* opts); +GVPR_API extern int gvpr (int argc, char *argv[], gvpropts* opts); #endif