[R] Calling function in DLL using .C

Alex van der Spek doorz at xs4all.nl
Tue Jan 24 12:49:26 CET 2012


I cannot understand why a function appears to be available to R 
(is.loaded('planckwR') returns TRUE) but the call with .C results in an 
error message:

C symbol name 'planckwR' not in DLL for package <path to DLL file here>

This is what I do:

  Loading a homebrewed DLL, compiled with MS VS97. The functions are all 
void, the C calling sequence is used and all arguments are passed by 
reference. Done things much like this many times with both Fortran and C 
subroutines and functions and called those successfully from either VBA 
or Python.

R code like this:

++++++++++++++++

dllpath<-file.path('path to dill', paste('Planck', 
.Platform$dynlib.ext,sep=''))
dll<-dyn.load(dllpath)


dllinfo<-getLoadedDLLs()
is.loaded('planckwR')
getNativeSymbolInfo('planckwR')

+++++++++++++++++++++
is.loaded returns TRUE.

getNativeSymbolInfo returns the name and a pointer to the address of the 
function planckwR. The $package element of the list returned by 
getNativeSymbolInfo is NULL, which adds to my confusion as it should be 
a list of 3 elements.

What am I missing here? All help much appreciated.

Alex van der Spek



More information about the R-help mailing list