www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Problems with static linking of c libraries

Hey all,

I'm trying to build a D application which statically links in the the blas
and lapack libraries
(from http://icl.cs.utk.edu/lapack-for-windows/clapack/index.html ). When
downloading the
pre-build libraries from the website I link them in using:

pragma(lib, "blas");
pragma(lib, "lapack");

Compiling isn't a problem but then optlink complains:

OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
blas.lib
 Error 43: Not a Valid Library File

First I thought this was due to the fact that I was running on windows 2008
(32 bit version) but
I also tried on windows XP professional, with the same result...

I decided to build the libraries myself using Cmake and VisualStudio 2010,
this however also
has the same result:

OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
blas.lib
 Error 43: Not a Valid Library File

I am able to build the packages using the MinGW toolchain (using GNU C/CPP)
however I then end up with
libblas.a and liblapack.a files, which causes the linker to not find the
libraries (under windows it searches for
the .lib extension). renaming them leads again to the msg seen above (Not a
Valid Library)

Any help on how to statically link these 2 packages in my executable using
windows ?

Kid regards,
Danny

Ps. I need to avoid the use of dynamic linking
Jul 14 2011