diff -Naur graphviz-2.44.1-orig/lib/cdt/Makefile.am graphviz-2.44.1/lib/cdt/Makefile.am
--- graphviz-2.44.1-orig/lib/cdt/Makefile.am	2020-06-29 11:47:18.000000000 +0300
+++ graphviz-2.44.1/lib/cdt/Makefile.am	2020-10-30 13:16:53.180901900 +0300
@@ -8,6 +8,9 @@
 pkgconfigdir = $(libdir)/pkgconfig
 
 AM_CPPFLAGS = -I$(top_srcdir)
+if WITH_WIN32
+AM_CFLAGS = -DEXPORT_CDT=1
+endif
 
 pkginclude_HEADERS = cdt.h
 noinst_HEADERS = dthdr.h
diff -Naur graphviz-2.44.1-orig/lib/cgraph/Makefile.am graphviz-2.44.1/lib/cgraph/Makefile.am
--- graphviz-2.44.1-orig/lib/cgraph/Makefile.am	2020-06-29 11:47:18.000000000 +0300
+++ graphviz-2.44.1/lib/cgraph/Makefile.am	2020-10-30 13:16:53.191871100 +0300
@@ -11,6 +11,10 @@
 	-I$(top_srcdir)/lib/cdt \
 	-Iinclude
 
+if WITH_WIN32
+AM_CFLAGS = -DEXPORT_CGRAPH=1 -DEXPORT_AGXBUF=1 -DEXPORT_CGHDR=1
+endif
+
 pkginclude_HEADERS = cgraph.h
 noinst_HEADERS = agxbuf.h cghdr.h include/malloc.h
 noinst_LTLIBRARIES = libcgraph_C.la
diff -Naur graphviz-2.44.1-orig/lib/common/globals.h graphviz-2.44.1/lib/common/globals.h
--- graphviz-2.44.1-orig/lib/common/globals.h	2020-06-29 11:47:18.000000000 +0300
+++ graphviz-2.44.1/lib/common/globals.h	2020-10-30 14:11:04.013001900 +0300
@@ -29,6 +29,8 @@
 #if !defined(_BLD_dotneato) && defined(__IMPORT__)
 #   define external __IMPORT__
 #endif
+#endif
+
 #if defined(GVDLL)
 #if !defined(_BLD_gvc)
 #define extern	__declspec(dllimport)
@@ -36,9 +38,8 @@
 #define extern __declspec(dllexport)
 #endif
 #endif
-#endif
 /*visual studio*/
-#ifdef _WIN32
+#ifdef _MSC_VER
 #ifndef GVC_EXPORTS
 #define extern __declspec(dllimport)
 #endif
diff -Naur graphviz-2.44.1-orig/lib/common/memory.h graphviz-2.44.1/lib/common/memory.h
--- graphviz-2.44.1-orig/lib/common/memory.h	2020-06-29 11:47:18.000000000 +0300
+++ graphviz-2.44.1/lib/common/memory.h	2020-10-30 15:27:35.649478500 +0300
@@ -32,17 +32,17 @@
 #define ALLOC(size,ptr,type) (ptr? (type*)grealloc(ptr,(size)*sizeof(type)):(type*)gmalloc((size)*sizeof(type)))
 #define RALLOC(size,ptr,type) ((type*)grealloc(ptr,(size)*sizeof(type)))
 #define ZALLOC(size,ptr,type,osize) (ptr? (type*)zrealloc(ptr,size,sizeof(type),osize):(type*)zmalloc((size)*sizeof(type)))
+
 #ifdef GVDLL
 #define extern __declspec(dllexport)
-#else
-#ifdef _WIN32
+#endif
+
+#ifdef _MSC_VER
 #ifndef GVC_EXPORTS
 #define extern __declspec(dllimport)
 #endif
 #endif
 
-#endif
-
     extern void *zmalloc(size_t);
     extern void *zrealloc(void *, size_t, size_t, size_t);
     extern void *gcalloc(size_t nmemb, size_t size);
diff -Naur graphviz-2.44.1-orig/lib/common/pointset.h graphviz-2.44.1/lib/common/pointset.h
--- graphviz-2.44.1-orig/lib/common/pointset.h	2020-06-29 11:47:18.000000000 +0300
+++ graphviz-2.44.1/lib/common/pointset.h	2020-10-30 14:14:37.625078600 +0300
@@ -23,6 +23,7 @@
 
     typedef Dict_t PointSet;
     typedef Dict_t PointMap;
+
 #ifdef GVDLL
 #define extern __declspec(dllexport)
 #else
@@ -30,13 +31,13 @@
 #endif
 
 /*visual studio*/
-#ifdef _WIN32
+#ifdef _MSC_VER
 #ifndef GVC_EXPORTS
 #undef extern
 #define extern __declspec(dllimport)
 #endif
 #endif
-/*end visual studio*/
+/*visual studio*/
 
 	extern PointSet *newPS(void);
     extern void freePS(PointSet *);
diff -Naur graphviz-2.44.1-orig/lib/common/render.h graphviz-2.44.1/lib/common/render.h
--- graphviz-2.44.1-orig/lib/common/render.h	2020-06-29 11:47:18.000000000 +0300
+++ graphviz-2.44.1/lib/common/render.h	2020-10-30 14:16:19.445274700 +0300
@@ -57,12 +57,12 @@
     } epsf_t;
 
 /*visual studio*/
-#ifdef _WIN32
+#ifdef _MSC_VER
 #ifndef GVC_EXPORTS
 #define extern __declspec(dllimport)
 #endif
 #endif
-/*end visual studio*/
+/*visual studio*/
 
 	extern void add_box(path *, boxf);
     extern void arrow_flags(Agedge_t * e, int *sflag, int *eflag);
diff -Naur graphviz-2.44.1-orig/lib/common/utils.h graphviz-2.44.1/lib/common/utils.h
--- graphviz-2.44.1-orig/lib/common/utils.h	2020-06-29 11:47:18.000000000 +0300
+++ graphviz-2.44.1/lib/common/utils.h	2020-10-30 14:16:51.641849800 +0300
@@ -18,14 +18,13 @@
 extern "C" {
 #endif
 
-
 /*visual studio*/
-#ifdef _WIN32
+#ifdef _MSC_VER
 #ifndef GVC_EXPORTS
 #define extern __declspec(dllimport)
 #endif
 #endif
-/*end visual studio*/
+/*visual studio*/
 
 #ifndef HAVE_STRCASECMP
     extern int strcasecmp(const char *s1, const char *s2);
diff -Naur graphviz-2.44.1-orig/lib/edgepaint/lab_gamut.h graphviz-2.44.1/lib/edgepaint/lab_gamut.h
--- graphviz-2.44.1-orig/lib/edgepaint/lab_gamut.h	2020-06-29 11:47:18.000000000 +0300
+++ graphviz-2.44.1/lib/edgepaint/lab_gamut.h	2020-10-30 13:16:53.266667500 +0300
@@ -15,11 +15,15 @@
 extern "C" {
 #endif
 
-/*visual studio*/
-#if defined(_WIN32) && !defined(LAB_GAMUT_EXPORTS)
-#define extern __declspec(dllimport)
+#ifdef _WIN32
+#   ifdef LAB_GAMUT_EXPORTS
+#       define extern __declspec(dllexport)
+#   else
+#       define extern __declspec(dllimport)
+#   endif
+#else
+#   define extern extern
 #endif
-/*end visual studio*/
 
 extern const signed char lab_gamut_data[];
 extern int lab_gamut_data_size;
diff -Naur graphviz-2.44.1-orig/lib/edgepaint/Makefile.am graphviz-2.44.1/lib/edgepaint/Makefile.am
--- graphviz-2.44.1-orig/lib/edgepaint/Makefile.am	2020-06-29 11:47:18.000000000 +0300
+++ graphviz-2.44.1/lib/edgepaint/Makefile.am	2020-10-30 13:16:53.273680200 +0300
@@ -15,6 +15,10 @@
 	-I$(top_srcdir)/lib/cgraph \
 	-I$(top_srcdir)/lib/cdt $(ANN_CFLAGS)
 
+if WITH_WIN32
+AM_CFLAGS = -DLAB_GAMUT_EXPORTS=1
+endif
+
 noinst_HEADERS =  edge_distinct_coloring.h  furtherest_point.h  intersection.h  lab_gamut.h  lab.h  node_distinct_coloring.h
 
 noinst_LTLIBRARIES = libedgepaint_C.la
diff -Naur graphviz-2.44.1-orig/lib/gvc/gvc.h graphviz-2.44.1/lib/gvc/gvc.h
--- graphviz-2.44.1-orig/lib/gvc/gvc.h	2020-06-29 11:47:18.000000000 +0300
+++ graphviz-2.44.1/lib/gvc/gvc.h	2020-10-30 14:18:50.603735700 +0300
@@ -28,14 +28,14 @@
 #endif
 
 /*visual studio*/
-#ifdef _WIN32
+#ifdef _MSC_VER
 #ifndef GVC_EXPORTS
 #undef extern
 #define extern __declspec(dllimport)
 #endif
 #endif
 /*end visual studio*/
-	
+
 #define LAYOUT_DONE(g) (agbindrec(g, "Agraphinfo_t", 0, TRUE) && GD_drawing(g))
 
 /* misc */
diff -Naur graphviz-2.44.1-orig/lib/gvc/gvcext.h graphviz-2.44.1/lib/gvc/gvcext.h
--- graphviz-2.44.1-orig/lib/gvc/gvcext.h	2020-06-29 11:47:18.000000000 +0300
+++ graphviz-2.44.1/lib/gvc/gvcext.h	2020-10-30 13:16:53.286613300 +0300
@@ -64,7 +64,7 @@
     typedef struct gvplugin_available_s gvplugin_available_t;
 
 /*visual studio*/
-#ifdef _WIN32
+#ifdef _MSC_VER
 #ifndef GVC_EXPORTS
 __declspec(dllimport) lt_symlist_t lt_preloaded_symbols[];
 #else
@@ -77,11 +77,11 @@
 /*end visual studio*/
 
 
-#ifndef _WIN32
-#if defined(GVDLL)
+#ifndef _MSC_VER
+#if !defined(LTDL_H)
+#if defined(GVDLL) && defined(_BLD_gvc)
 	__declspec(dllexport) lt_symlist_t lt_preloaded_symbols[];
 #else
-#if !defined(LTDL_H)
 	extern lt_symlist_t lt_preloaded_symbols[];
 #endif
 #endif
diff -Naur graphviz-2.44.1-orig/lib/gvc/gvio.h graphviz-2.44.1/lib/gvc/gvio.h
--- graphviz-2.44.1-orig/lib/gvc/gvio.h	2020-06-29 11:47:18.000000000 +0300
+++ graphviz-2.44.1/lib/gvc/gvio.h	2020-10-30 14:20:15.713025900 +0300
@@ -27,7 +27,7 @@
 #endif
 
 /*visual studio*/
-#ifdef _WIN32
+#ifdef _MSC_VER
 #ifndef GVC_EXPORTS
 #undef extern
 #define extern __declspec(dllimport)
diff -Naur graphviz-2.44.1-orig/lib/gvc/gvplugin_loadimage.h graphviz-2.44.1/lib/gvc/gvplugin_loadimage.h
--- graphviz-2.44.1-orig/lib/gvc/gvplugin_loadimage.h	2020-06-29 11:47:18.000000000 +0300
+++ graphviz-2.44.1/lib/gvc/gvplugin_loadimage.h	2020-10-30 14:33:22.915187400 +0300
@@ -22,12 +22,12 @@
 extern "C" {
 #endif
 
-#ifdef GVDLL
-#  define extern __declspec(dllexport)
-#endif
+#if defined(_BLD_pathplan) && defined(__EXPORT__)
+#   define extern __EXPORT__
+ #endif
 
 /*visual studio*/
-#ifdef _WIN32
+#ifdef _MSC_VER
 #ifndef GVC_EXPORTS
 #define extern __declspec(dllimport)
 #endif
diff -Naur graphviz-2.44.1-orig/lib/gvc/gvusershape.c graphviz-2.44.1/lib/gvc/gvusershape.c
--- graphviz-2.44.1-orig/lib/gvc/gvusershape.c	2020-06-29 11:47:18.000000000 +0300
+++ graphviz-2.44.1/lib/gvc/gvusershape.c	2020-10-30 13:57:40.775214000 +0300
@@ -28,13 +28,14 @@
 #define DMKEY "Software\\Microsoft" //key to look for library dir
 #endif
 
+#define _BLD_gvc 1
+
 #include <regex.h>
 #include "types.h"
 #include "logic.h"
 #include "memory.h"
 #include "agxbuf.h"
 
-#define _BLD_gvc 1
 #include "utils.h"
 #include "gvplugin_loadimage.h"
 
diff -Naur graphviz-2.44.1-orig/lib/gvpr/gprstate.c graphviz-2.44.1/lib/gvpr/gprstate.c
--- graphviz-2.44.1-orig/lib/gvpr/gprstate.c	2020-06-29 11:47:18.000000000 +0300
+++ graphviz-2.44.1/lib/gvpr/gprstate.c	2020-10-30 13:16:53.314416400 +0300
@@ -17,6 +17,8 @@
  *
  */
 
+#include "config.h"
+
 #ifdef _WIN32
 #include "windows.h"
 #include "shlwapi.h"
@@ -139,7 +141,7 @@
     free (state);
 }
 
-#ifdef WIN32_DLL
+#if defined(WIN32_DLL) || defined(GVDLL)
 int pathisrelative (char* path)
 {
     return PathIsRelative(path);
diff -Naur graphviz-2.44.1-orig/lib/gvpr/gvpr.c graphviz-2.44.1/lib/gvpr/gvpr.c
--- graphviz-2.44.1-orig/lib/gvpr/gvpr.c	2020-06-29 11:47:18.000000000 +0300
+++ graphviz-2.44.1/lib/gvpr/gvpr.c	2020-10-30 13:16:53.321397500 +0300
@@ -219,7 +219,7 @@
     Sfio_t *pathp = NULL;
     size_t sz;
 
-#ifdef WIN32_DLL
+#if defined(WIN32_DLL) || defined(GVDLL)
     if (!pathisrelative(arg))
 #else
     if (strchr(arg, '/'))
diff -Naur graphviz-2.44.1-orig/lib/gvpr/Makefile.am graphviz-2.44.1/lib/gvpr/Makefile.am
--- graphviz-2.44.1-orig/lib/gvpr/Makefile.am	2020-06-29 11:47:18.000000000 +0300
+++ graphviz-2.44.1/lib/gvpr/Makefile.am	2020-10-30 13:16:53.329372700 +0300
@@ -20,6 +20,10 @@
 	-I$(top_srcdir)/lib/cdt \
 	-DDFLT_GVPRPATH="\".$(PATH_SEPARATOR)$(pkgdatadir)/gvpr\""
 
+if WITH_WIN32
+AM_CFLAGS = -DEXPORT_GVPR=1
+endif
+
 pkginclude_HEADERS = gvpr.h
 noinst_HEADERS = actions.h compile.h gprstate.h parse.h queue.h trieFA.h trie.c
 noinst_LTLIBRARIES = libgvpr_C.la
diff -Naur graphviz-2.44.1-orig/lib/pack/pack.h graphviz-2.44.1/lib/pack/pack.h
--- graphviz-2.44.1-orig/lib/pack/pack.h	2020-06-29 11:47:18.000000000 +0300
+++ graphviz-2.44.1/lib/pack/pack.h	2020-10-30 14:37:53.021404400 +0300
@@ -58,7 +58,7 @@
     } pack_info;
 
 /*visual studio*/
-#ifdef _WIN32
+#ifdef _MSC_VER
 #ifndef GVC_EXPORTS
 #define extern __declspec(dllimport)
 #endif
diff -Naur graphviz-2.44.1-orig/lib/pathplan/Makefile.am graphviz-2.44.1/lib/pathplan/Makefile.am
--- graphviz-2.44.1-orig/lib/pathplan/Makefile.am	2020-06-29 11:47:18.000000000 +0300
+++ graphviz-2.44.1/lib/pathplan/Makefile.am	2020-10-30 13:16:53.366274400 +0300
@@ -8,6 +8,7 @@
 
 if WITH_WIN32
 AM_CPPFLAGS = -O0
+AM_CFLAGS = -DPATHPLAN_EXPORTS=1
 endif
 
 pkginclude_HEADERS = pathgeom.h pathplan.h
diff -Naur graphviz-2.44.1-orig/lib/pathplan/pathgeom.h graphviz-2.44.1/lib/pathplan/pathgeom.h
--- graphviz-2.44.1-orig/lib/pathplan/pathgeom.h	2020-06-29 11:47:18.000000000 +0300
+++ graphviz-2.44.1/lib/pathplan/pathgeom.h	2020-10-30 14:29:54.748903100 +0300
@@ -19,6 +19,16 @@
 extern "C" {
 #endif
 
+/*#ifdef _WIN32
+#   ifdef PATHPLAN_EXPORTS
+#       define extern __declspec(dllexport)
+#   else
+#       define extern __declspec(dllimport)
+#   endif
+#else
+#   define extern extern
+#endif*/
+
 #ifdef HAVE_POINTF_S
     typedef struct pointf_s Ppoint_t;
     typedef struct pointf_s Pvector_t;
@@ -45,7 +55,7 @@
 /* opaque state handle for visibility graph operations */
     typedef struct vconfig_s vconfig_t;
 
-    void freePath(Ppolyline_t* p);
+    extern void freePath(Ppolyline_t* p);
 #ifdef __cplusplus
 }
 #endif
diff -Naur graphviz-2.44.1-orig/lib/xdot/xdot.h graphviz-2.44.1/lib/xdot/xdot.h
--- graphviz-2.44.1-orig/lib/xdot/xdot.h	2020-06-29 11:47:18.000000000 +0300
+++ graphviz-2.44.1/lib/xdot/xdot.h	2020-10-30 15:25:02.856199900 +0300
@@ -22,7 +22,7 @@
 #endif
 
 #ifdef _WIN32
-#   ifdef EXPORT_XDOT
+#   if defined(EXPORT_XDOT) || defined(GVDLL)
 #       define XDOT_API __declspec(dllexport)
 #   else
 #       define XDOT_API __declspec(dllimport)
diff -Naur graphviz-2.44.1-orig/tclpkg/gdtclft/gdtclft.c graphviz-2.44.1/tclpkg/gdtclft/gdtclft.c
--- graphviz-2.44.1-orig/tclpkg/gdtclft/gdtclft.c	2020-06-29 11:47:19.000000000 +0300
+++ graphviz-2.44.1/tclpkg/gdtclft/gdtclft.c	2020-10-30 13:16:53.736965700 +0300
@@ -1270,7 +1270,8 @@
 #ifdef __CYGWIN__
 int Gdtclft_Init(Tcl_Interp * interp)
 #else
-#ifdef __WIN32__
+#ifdef _MSC_VER
+
 EXPORT(int, Gdtclft_Init) (interp)
 #else
 int Gdtclft_Init(Tcl_Interp * interp)
@@ -1296,7 +1297,7 @@
 #ifdef __CYGWIN__
 int Gdtclft_SafeInit(Tcl_Interp * interp)
 #else
-#ifdef __WIN32__
+#ifdef _MSC_VER
 EXPORT(int, Gdtclft_SafeInit) (interp)
 #else
 int Gdtclft_SafeInit(Tcl_Interp * interp)
