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
This commit is contained in:
Isuru Fernando
2019-03-27 12:39:31 -05:00
committed by Devrajegowda, Kiran
parent b495ca9b76
commit aa9d8e4a81
2 changed files with 16 additions and 9 deletions

View File

@@ -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

View File

@@ -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