This clearly should be possible. However, I should confess that I do not
know how to compile DLL under VS. I have done it once under Cygwin but
have not learnt yet how to do it under VS. The first part - to change
the compiler flag to compile the object files is simple. Just edit
config/win32.mk, for example change CFLAGS to
CFLAGS = /nologo /O2 /W3 /D "WIN32" /MD
to have /MD option. Then all the object files will be compiled with this
option. So the question is how to make a DLL from the object files. If
you send me a command for VS to do it from the command line , I could
think on how to implement it in the makefile.
...
> cl /nologo /MT /F64000000 /Febin\\win32\\direct.exe obj\
> \win32\\direct.obj lib\\win32\\li
> btaucs.lib external\\lib\\win32\\liblapack.lib external\\lib\\win32\
> \libf77blas.lib external\\lib\\
> win32\\libcblas.lib external\\lib\\win32\\libatlas.lib external\\lib\
> \win32\\libmetis.lib external\\
> lib\\win32\\vcf2c.lib
> LIBCMT.lib(dosmap.obj) : error LNK2005: __errno already defined in
> MSVCRTD.lib(MSVCR71D.dll)
...
> LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of
> other libs; use /NODEFAULTLIB:lib
> rary
> LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of
> other libs; use /NODEFAULTLIB:libr
> ary
The linker try to use both run time libraries LIBCMT.lib and
MSVCRTD.lib. This will not work. It is necessary to understand why this
happens. First the flag is wrong - it is /MT and and /MD.
I guess it is necessary to change LDFLAGS in win32.mk as well
LDFLAGS = /nologo /MD /F64000000
However, it may not solve the problem as VC writes the default libraries
in the object files. And the libraries included with TAUCS have been
compiled with /MT, that is, for them LIBCMT.lib is the default library.
I do not know how to check it correctly but the brute force approach
strings libmetis.lib | grep -i libcmt
shows that both metis and f2c has such a text. It could be possible to
add /NODEFAULTLIB:LIBCMT.lib to the command above but it could be that
it should go after -link at the end of the command. Hard to say how to
do it in win32.mk. It could be simpler just to copy this command in some
batch file and edit there. Though I do not know if this will help, it
well might be that LIBCMT.lib has some symbols that are not available in
MSVCRTD.lib. But it makes sense to try it.
If this will not help, then you have to recompile the libraries on which
TAUCS depends with /MD. The life is not that simple.
If you have MKL, then it is possible to use it for the optimized BLAS
and then it would be necessary just to recompile METIS. The latter is
pretty simple, METIS is not that complicated.
Evgenii
TAUCS needs METIS for reodering. There are other reodering schemes in
TAUCS but METIS seems to be the fastest - see for example slide 18 in
http://modelreduction.com/doc/teaching/eurosime/lecture2.pdf
It is not a problem to compile METIS under /MD, if you need
instructions, I can make them. METIS is free for research, please look
at the METIS copyright.
Then TAUCS needs BLAS, well, if you need speed, then the optimized BLAS.
You can compare the reference BLAS with ATLAS at
http://matrixprogramming.com/MatrixMultiply/
If speed is not essential you can use LAPACK from Netlib that contains
the reference BLAS. They are public domain, that is, completely free. It
is relatively easy to compile them under /MD but to this end you need
Intel Fortran.
A free optimized BLAS is ATLAS but I have never compiled it under MS VS.
It should be possible, it seems that the TAUCS author has done it, but
my experience with ATLAS tells me that this is not an easy thing.
Actually it would be good to look at the latest ATLAS and to see what
people say about it.
MKL is the optimized BLAS from Intel. It is not free but it allows us to
save some time. I have it and hence like it.
...
> LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of
> other libs; use /NODEFAULTLIB:lib
> rary
> LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of
> other libs; use /NODEFAULTLIB:libr
> ary
There is still a conflict between LIBCMT and MSVCRTD. You can try to use
the flag /NODEFAULTLIB:LIBCMT. It could help.
>> If this will not help, then you have to recompile the libraries on which
>> TAUCS depends with /MD. The life is not that simple.
>
> What libraries are those?
Look in external/lib/win32
The optimized BLAS (ATLAS)
liblapack.lib libf77blas.lib libcblas.lib libatlas.lib
f2c(g2c) as some Fortran code in ATLAS has been compiled with g77 or
with f2c
vcf2c.lib
METIS
libmetis.lib
>> If you have MKL, then it is possible to use it for the optimized BLAS
>> and then it would be necessary just to recompile METIS. The latter is
>> pretty simple, METIS is not that complicated.
>
> What's MKL and METIS?
I have answered this in another email.
I should confess that I do not know well, how different runtime
libraries in MS VC function. But if this works, then why not. Start with
this, run tests if everything is working they it should be okay. If you
see crashes during TAUCS calls, you may return back to this point later on.