diff -urN a/frmts/hdf5/makefile.vc b/frmts/hdf5/makefile.vc
--- a/frmts/hdf5/makefile.vc	2019-10-28 12:56:14.000000000 +0300
+++ b/frmts/hdf5/makefile.vc	2022-01-24 12:51:29.865009803 +0300
@@ -7,7 +7,7 @@
 
 PLUGIN_DLL 	=	gdal_HDF5.dll
 
-EXTRAFLAGS 	= 	-I$(HDF5_DIR)\include -DWIN32 -D_HDF5USEDLL_ 
+EXTRAFLAGS 	= 	-I$(HDF5_DIR)\include -DWIN32 -DH5_BUILT_AS_DYNAMIC_LIB
 
 !IF "$(HDF5_PLUGIN)" == "YES"
 EXTRAFLAGS = $(EXTRAFLAGS) -DHDF5_PLUGIN
