[R] Linking Rblas

Rau, Roland Rau at demogr.mpg.de
Thu Mar 9 11:52:15 CET 2006


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 should call
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 reference to
`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 C-file) but
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 calling C, ..:
just let me know.

Thanks,
Roland

> version
         _              
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 conditions.  There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

+++++
This mail has been sent through the MPI for Demographic Rese...{{dropped}}




More information about the R-help mailing list