From a8d4d1c4d366da71315877f82b5d3a42d40d51e2 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Sat, 17 May 2014 16:21:21 -0700 Subject: [PATCH] Build import library for mingw Signed-off-by: Timothy Gu --- Makefile.install | 1 + exports/Makefile | 12 +++--------- exports/dllinit.c | 2 +- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/Makefile.install b/Makefile.install index 6fcbcc3e1..d40bdd402 100644 --- a/Makefile.install +++ b/Makefile.install @@ -80,6 +80,7 @@ ifeq ($(OSNAME), Darwin) endif ifeq ($(OSNAME), WINNT) @-cp $(LIBDLLNAME) $(OPENBLAS_BINARY_DIR) + @-cp $(LIBDLLNAME).a $(OPENBLAS_LIBRARY_DIR) endif ifeq ($(OSNAME), CYGWIN_NT) @-cp $(LIBDLLNAME) $(OPENBLAS_BINARY_DIR) diff --git a/exports/Makefile b/exports/Makefile index e09b3c3ad..ce28ab5cc 100644 --- a/exports/Makefile +++ b/exports/Makefile @@ -83,15 +83,9 @@ dll : ../$(LIBDLLNAME) # For more details see: https://github.com/xianyi/OpenBLAS/issues/127. ../$(LIBDLLNAME) : ../$(LIBNAME) libopenblas.def dllinit.$(SUFFIX) $(RANLIB) ../$(LIBNAME) -ifeq ($(BINARY32), 1) - $(DLLWRAP) -o ../$(LIBDLLNAME) --def libopenblas.def \ - --entry _dllinit@12 -s dllinit.$(SUFFIX) --dllname $(@F) ../$(LIBNAME) $(EXTRALIB) - -lib /machine:i386 /def:libopenblas.def -else - $(DLLWRAP) -o ../$(LIBDLLNAME) --def libopenblas.def \ - --entry $(FU)dllinit -s dllinit.$(SUFFIX) --dllname $(@F) ../$(LIBNAME) $(EXTRALIB) - -lib /machine:X64 /def:libopenblas.def -endif + $(CC) $(CFLAGS) $(LDFLAGS) libopenblas.def dllinit.$(SUFFIX) \ + -shared -o ../$(LIBDLLNAME) -Wl,--out-implib,../$(LIBDLLNAME).a \ + -Wl,--whole-archive ../$(LIBNAME) -Wl,--no-whole-archive $(FEXTRALIB) libopenblas.def : gensymbol perl ./gensymbol win2k $(ARCH) dummy $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) $(ONLY_CBLAS) > $(@F) diff --git a/exports/dllinit.c b/exports/dllinit.c index 54ec1c36c..0f25824f1 100644 --- a/exports/dllinit.c +++ b/exports/dllinit.c @@ -41,7 +41,7 @@ void gotoblas_init(void); void gotoblas_quit(void); -BOOL APIENTRY dllinit(HINSTANCE hInst, DWORD reason, LPVOID reserved) { +BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD reason, LPVOID reserved) { if (reason == DLL_PROCESS_ATTACH) { gotoblas_init();