diff --git a/src/webp/types.h b/src/webp/types.h index 0ce2622..69f7e89 100644 --- a/src/webp/types.h +++ b/src/webp/types.h @@ -39,7 +39,9 @@ typedef long long int int64_t; #ifndef WEBP_EXTERN // This explicitly marks library functions and allows for changing the // signature for e.g., Windows DLL builds. -# if defined(__GNUC__) && __GNUC__ >= 4 +# if defined(_MSC_VER) && defined(WEBP_DLL) +# define WEBP_EXTERN __declspec(dllexport) +# elif defined(__GNUC__) && __GNUC__ >= 4 # define WEBP_EXTERN extern __attribute__ ((visibility ("default"))) # else # define WEBP_EXTERN extern diff --git a/CMakeLists.txt b/CMakeLists.txt index 2501012..2e090e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,2 +16,6 @@ project(WebP C) +if(MSVC AND BUILD_SHARED_LIBS) + add_definitions(-DWEBP_DLL) +endif() + # Options for coder / decoder executables.