Skip to content

Help with DLLs

3 messages · Jane L. Harvill, Uwe Ligges, Brian Ripley

#
I'm using R version 1.5.1, and Microsoft Developer Studio 97 (yes, I know
it's old, but it's expensive to upgrade) on Windows 98.  I created the DLL
file with the compiler.  The name of the file containing the subroutine is
leaf.f and the subroutine is named leaf.f. In my R program (which defines
a function called leaf), I have 
	x <- .Fortran("leaf",...)  
where the ... are the arguments passed.  I source("leaf.s"), and then
dyn.load("leaf.dll"), and when I run leaf(100), I get the following error

Error in .Fortran("leaf",as.integer(nn),as.double(u),as.double(A), :
         C/Fortran function name not in load table

Does anyone know what is causing this error message and how to fix the
problem?
Incidentally, the same code works FINE on the Unix version of R, but I was
hoping to transfer it to my PC so that I could use it in a presentation
without having to rely on an unreliable internet connection.

Any words of wisdom are greatly appreciated.

Sincerely,
Jane Harvill



Dr. Jane L. Harvill, Ph.D.
Department of Mathematics and Statistics
Drawer MA
Mississippi State, Mississippi 39762
Phone: (662) 325-3414
FAX:   (662) 325-0005
URL:   http://www2.msstate.edu/~harvill/


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
"Jane L. Harvill" wrote:
If your subroutine is called "leaf.f", it's a good idea to call this
one, but not "leaf".

Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
DO read readme.packages.

1) Did you export the symbols from your DLL?  It's the most common fault.
pedump will tell you, as will dump under VC++6 (at least).

2) .Fortran is designed for use with g77, and whatever you are using
(I was unaware that  Developer Studio 97 contained a Fortran compiler)
may well be using different conventions, so readme.packages tells you to
use .C with the name-mangled symbol produced.

3) The recommended compilers for use with R for Windows are *free*.
You are likely to find it much easier to follow the recommendations.
On Thu, 17 Oct 2002, Jane L. Harvill wrote:

            
^^^^^^
Really?  Not leaf?