Dear R-ers Could you tell me how to build DLL from Fortran source and use the DLL in R? Environments: Windows 98 Fortran compiler : DIGITAL Visual Fortran Optimizing Compiler Version: V5.0 R v1.2.3 EXAMPLE SOURCE : FOO.FOR ------------------------------------- SUBROUTINE FOO(I,J) INTEGER I,J I=0 J=I+1 END ------------------------------------- I compiled FOO.FOR with DLL option. C:\> DF FOO.FOR /DLL ##### ### #### FOO.DLL Then, I could build FOO.DLL and used R as follows. R> print(dyn.load("FOO.DLL")) NULL R> I could not load FOO.DLL. I am not sure whether FOO.DLL is bad or not. Could you tell me how to build DLL in Visual Fortran or another fortran compiler on Windows? I will appreciate it, if you give me a sample Fortran code and any advice to build and use DLL. Best Regards, Baba -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Sat, 19 Jan 2002 baba at mxr.mesh.ne.jp wrote:> Dear R-ers > > Could you tell me how to build DLL from Fortran source and use the DLL in R? > > Environments: > Windows 98 > Fortran compiler : DIGITAL Visual Fortran Optimizing Compiler Version: V5.0 > R v1.2.3^^^^^ that isn't the problem, but you really should upgrade at least once a year.> EXAMPLE SOURCE : FOO.FOR > ------------------------------------- > SUBROUTINE FOO(I,J) > INTEGER I,J > I=0 > J=I+1 > END > ------------------------------------- >> > R> print(dyn.load("FOO.DLL")) > NULL > R> > > I could not load FOO.DLL. I am not sure whether FOO.DLL is bad or not.That looks as if you *did* load it. There was no error message, and dyn.load() is supposed to return NULL (though this could be documented better). To check, you can try is.loaded(symbol.For("FOO")) to see if SUBROUTINE FOO is accessible to .Fortran calls. -thomas Thomas Lumley Asst. Professor, Biostatistics tlumley at u.washington.edu University of Washington, Seattle -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Dear Thomas Lumley Thank you very much for your support. Thomas Lumley Forward: On Sat, 19 Jan 2002 baba at mxr.mesh.ne.jp wrote:>> >> R> print(dyn.load("FOO.DLL")) >> >> NULL >> >> This means that FOO.DLL is not loaded. >> If FOO.DLL is loaded, any subroutine name available should be output. >> > >No. dyn.load() always returns NULL. There is an error message if the DLL >could not be loaded. > >You can check this by using dyn.load() on one of the DLLs in the base or >recommended packages. >Yes. I could check it on other recommemmded DLL.>Why did you think this would work? I can't find anything in the R >documentation that suggests dyn.load() returns a list of symbols.I read Japanese Traslated Book of "The New S Language" by Becker, Chambers, Wilks (1988). In Chapter 7.2.1, Dynamic loading is described. In this chapter, I found the following description: The Function "dyn.load" returns character vector of Routine name included in Object file loaded. For example, print(dyn.load("aaa.o")) returns Routine names which are available in all.o. I think R is mostly compatible of S language. This is why I wrote such question. Best Regards, Baba -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Possibly Parallel Threads
- Calling Fortran from R: Issues with dynamic loading of fortran dll
- RGui (Windows) crashes after use of a Salford Fortran DLL
- Problems with Fortran calls when loaded a dll compiled with gfortran-4 Cygwin 4.5.3
- Error of exp() in a dll from Fortran
- AXVoice Server Hacked.. accounts info leaked