diff --git a/Makefile.am b/Makefile.am index 1946af37..07d5af97 100644 --- a/Makefile.am +++ b/Makefile.am @@ -179,7 +179,7 @@ libvkd3d_shader_la_SOURCES = \ libs/vkd3d-shader/vkd3d_shader.map \ libs/vkd3d-shader/vkd3d_shader_main.c \ libs/vkd3d-shader/vkd3d_shader_private.h -libvkd3d_shader_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/libs/vkd3d-shader @SPIRV_TOOLS_CFLAGS@ +libvkd3d_shader_la_CFLAGS = $(AM_CFLAGS) -DLIBVKD3D_SHADER_SOURCE -I$(srcdir)/libs/vkd3d-shader @SPIRV_TOOLS_CFLAGS@ libvkd3d_shader_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:0:0 libvkd3d_shader_la_LIBADD = libvkd3d-common.la @SPIRV_TOOLS_LIBS@ -lm if HAVE_LD_VERSION_SCRIPT @@ -207,6 +207,7 @@ libvkd3d_la_SOURCES = \ libs/vkd3d/vkd3d_private.h \ libs/vkd3d/vkd3d_shaders.h \ libs/vkd3d/vulkan_procs.h +libvkd3d_la_CFLAGS = $(AM_CFLAGS) -DLIBVKD3D_SOURCE libvkd3d_la_LDFLAGS = $(AM_LDFLAGS) -version-info 3:0:2 libvkd3d_la_LIBADD = libvkd3d-common.la libvkd3d-shader.la @DL_LIBS@ @PTHREAD_LIBS@ if HAVE_LD_VERSION_SCRIPT @@ -218,6 +219,7 @@ libvkd3d_utils_la_SOURCES = \ libs/vkd3d-utils/vkd3d_utils.map \ libs/vkd3d-utils/vkd3d_utils_main.c \ libs/vkd3d-utils/vkd3d_utils_private.h +libvkd3d_utils_la_CFLAGS = $(AM_CFLAGS) -DLIBVKD3D_UTILS_SOURCE libvkd3d_utils_la_LDFLAGS = $(AM_LDFLAGS) -version-info 2:0:1 libvkd3d_utils_la_LIBADD = libvkd3d-common.la libvkd3d-shader.la libvkd3d.la @PTHREAD_LIBS@ if HAVE_LD_VERSION_SCRIPT diff --git a/include/vkd3d.h b/include/vkd3d.h index 1bb87b4a..61ccf6c3 100644 --- a/include/vkd3d.h +++ b/include/vkd3d.h @@ -153,10 +153,10 @@ struct vkd3d_image_resource_create_info D3D12_RESOURCE_STATES present_state; }; -#if defined(__GNUC__) && !defined(__MINGW32__) -# define VKD3D_API __attribute__((visibility("default"))) +#ifdef LIBVKD3D_SOURCE +# define VKD3D_API VKD3D_EXPORT #else -# define VKD3D_API +# define VKD3D_API VKD3D_IMPORT #endif #ifndef VKD3D_NO_PROTOTYPES diff --git a/include/vkd3d_shader.h b/include/vkd3d_shader.h index 24f99fb9..5092fac9 100644 --- a/include/vkd3d_shader.h +++ b/include/vkd3d_shader.h @@ -1340,10 +1340,10 @@ static inline uint32_t vkd3d_shader_create_swizzle(enum vkd3d_shader_swizzle_com | ((w & VKD3D_SHADER_SWIZZLE_MASK) << VKD3D_SHADER_SWIZZLE_SHIFT(3)); } -#if defined(__GNUC__) && !defined(__MINGW32__) -# define VKD3D_SHADER_API __attribute__((visibility("default"))) +#ifdef LIBVKD3D_SHADER_SOURCE +# define VKD3D_SHADER_API VKD3D_EXPORT #else -# define VKD3D_SHADER_API +# define VKD3D_SHADER_API VKD3D_IMPORT #endif #ifndef VKD3D_SHADER_NO_PROTOTYPES diff --git a/include/vkd3d_types.h b/include/vkd3d_types.h index 020eb240..7014f4c2 100644 --- a/include/vkd3d_types.h +++ b/include/vkd3d_types.h @@ -53,6 +53,17 @@ enum vkd3d_result VKD3D_FORCE_32_BIT_ENUM(VKD3D_RESULT), }; +#ifdef _WIN32 +# define VKD3D_IMPORT __declspec(dllimport) +# define VKD3D_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) +# define VKD3D_IMPORT +# define VKD3D_EXPORT __attribute__((visibility("default"))) +#else +# define VKD3D_IMPORT +# define VKD3D_EXPORT +#endif + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/include/vkd3d_utils.h b/include/vkd3d_utils.h index ea310a0e..a81f229d 100644 --- a/include/vkd3d_utils.h +++ b/include/vkd3d_utils.h @@ -34,10 +34,10 @@ extern "C" { #define VKD3D_WAIT_FAILED (~0u) #define VKD3D_INFINITE (~0u) -#if defined(__GNUC__) && !defined(__MINGW32__) -# define VKD3D_UTILS_API __attribute__((visibility("default"))) +#ifdef LIBVKD3D_UTILS_SOURCE +# define VKD3D_UTILS_API VKD3D_EXPORT #else -# define VKD3D_UTILS_API +# define VKD3D_UTILS_API VKD3D_IMPORT #endif /* 1.0 */