-----Original Message-----
From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk]
Sent: Thursday, March 09, 2006 12:09 PM
To: Rau, Roland
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] Linking Rblas [under Windows]
Yes, lots of packages link to Rblas. The help page for SHLIB
tells you
Please consult section 'Creating shared objects' in the manual
'Writing R Extensions' for how to customize it (for
example to add
'cpp' flags and to add libraries to the link step) and
for details
of some of its quirks.
so it should not have been at all hard to find the information.
A portable way would be to have a file Makevars containing
PKG_LIBS=$(BLAS_LIBS)
Note that your precise example will not work in R-2.3.0 when it is
released, whereas the portable form will. (In fact it only works in
R-2.2.0 if you have previously make libRblas.a.)
On Thu, 9 Mar 2006, Rau, Roland wrote:
Dear all,
when making a DLL via Rcmd SHLIB is there a way to link against a
library such as Rblas (I am on a Windows platform) on a case to case
basis?
I played a bit around with some self-written C-code which
the function 'dasum' defined in Blas.h.
I encountered the following problem:
u:\codeplay>Rcmd SHLIB mysumming.c
Rcmd SHLIB mysumming.c
gcc --shared -s -o mysumming.dll mysumming.def mysumming.a
-LU:/R/R-2.2.0/src/gnuwin32 -lg2c -lR
mysumming.a(mysumming.o)(.text+0x1b):mysumming.c: undefined
`dasum_'
collect2: ld returned 1 exit status
make: *** [mysumming.dll] Error 1
My (very limited) knowledge on C tells me that the function 'dasum'
is actually defined (due to #include <R_ext/BLAS.h> in my
it needs to be linked against the correct library during the linking
procedure. I guess the correct library should be Rblas.dll since I
could do it "by hand" calling gcc like this:
gcc --shared -s -o mysumming.dll mysumming.def mysumming.a
-LU:/R/R-2.2.0/src/gnuwin32 -lg2c -lR -lRblas
and it worked.
Thank you very much for your help in advance.
If you need more details such as the C-Code, the R-Code
just let me know.
Thanks,
Roland
_
platform i386-pc-mingw32
arch i386
os mingw32
system i386, mingw32
status
major 2
minor 2.0
year 2005
month 10
day 06
svn rev 35749
language R
u:\codeplay>gcc --version
gcc --version
gcc (GCC) 3.4.2 (mingw-special)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
+++++
This mail has been sent through the MPI for Demographic