From aa9d8e4a810c55bd34f284fa6e230f3889cca26a Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Wed, 27 Mar 2019 12:39:31 -0500 Subject: [PATCH] Test with shared on windows (#306) Export macros can't support both shared and static at the same time. When blis is built with both shared and static, headers assume that shared is used at link time and dllimports the symbols with __imp_ prefix. To use the headers with static libraries a user can give -DBLIS_EXPORT= to import the symbol without the __imp_ prefix --- common.mk | 5 +++++ frame/include/bli_config_macro_defs.h | 20 +++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/common.mk b/common.mk index ef0acfb50..5513098a5 100644 --- a/common.mk +++ b/common.mk @@ -530,6 +530,11 @@ ifeq ($(IS_WIN),no) LDFLAGS += -Wl,-rpath,$(BASE_LIB_PATH) endif endif +# On windows, use the shared library even if static is created. +ifeq ($(IS_WIN),yes) +LIBBLIS_L := $(LIBBLIS_SO) +LIBBLIS_LINK := $(LIBBLIS_SO_PATH) +endif endif diff --git a/frame/include/bli_config_macro_defs.h b/frame/include/bli_config_macro_defs.h index ed0056990..cef0b8432 100644 --- a/frame/include/bli_config_macro_defs.h +++ b/frame/include/bli_config_macro_defs.h @@ -203,20 +203,22 @@ // with that setting overridden only for function prototypes or variable // declarations that are annotated with BLIS_EXPORT_BLIS. -#if !defined(BLIS_ENABLE_SHARED) +#ifndef BLIS_EXPORT + #if !defined(BLIS_ENABLE_SHARED) #define BLIS_EXPORT -#else + #else #if defined(_WIN32) || defined(__CYGWIN__) - #ifdef BLIS_IS_BUILDING_LIBRARY - #define BLIS_EXPORT __declspec(dllexport) - #else - #define BLIS_EXPORT __declspec(dllimport) - #endif + #ifdef BLIS_IS_BUILDING_LIBRARY + #define BLIS_EXPORT __declspec(dllexport) + #else + #define BLIS_EXPORT __declspec(dllimport) + #endif #elif defined(__GNUC__) && __GNUC__ >= 4 - #define BLIS_EXPORT __attribute__ ((visibility ("default"))) + #define BLIS_EXPORT __attribute__ ((visibility ("default"))) #else - #define BLIS_EXPORT + #define BLIS_EXPORT #endif + #endif #endif #define BLIS_EXPORT_BLIS BLIS_EXPORT