gxx4@cwru.edu
2003-May-22 17:33 UTC
[R] help for calling a c program in the windows version R
Hi, all: I want to call a c program in the windows version R, so I compiled it in VC to get the dll file and use the command ?dyn.load? to call it in R. There is no error appeared for this command, but when I use the command ? is.loaded? to check, it shows that dll file isn?t be loaded. Does anyone have same experience or know the correct way to do it? Best wishes, Guan Xing 5/22/03
Uwe Ligges
2003-May-22 18:11 UTC
[R] help for calling a c program in the windows version R
gxx4 at cwru.edu wrote:> > Hi, all: > > I want to call a c program in the windows version R, so I compiled it in VC to get the dll file and use the command ?dyn.load? to call it in R. There is no error appeared for this command, but when I use the command ? is.loaded? to check, it shows that dll file isn?t be loaded. Does anyone have same experience or know the correct way to do it? > > Best wishes, > Guan Xing > 5/22/03I never used VC (Mingw's gcc is recommended), but I can tell you that there is some information in .../src/gnuwin32/readme.packages and I think also in Venables&Ripley (2000): S Programming, Springer (but not sure about that, since the latter is in my office). Uwe Ligges
Duncan Murdoch
2003-May-23 03:00 UTC
[R] help for calling a c program in the windows version R
On Thu, 22 May 2003 13:33:07 -0400, you wrote:>Hi, all: > >I want to call a c program in the windows version R, so I compiled it in VC to get the dll file and use the command ?dyn.load? to call it in R. There is no error appeared for this command, but when I use the command ? is.loaded? to check, it shows that dll file isn?t be loaded. Does anyone have same experience or know the correct way to do it?"is.loaded" doesn't check for the DLL, it checks for a particular entry point in the DLL. Most likely VC is exporting the function under a different name than you are searching for, or isn't exporting it at all. You can view all the exports in a DLL using the Quick View program that is distributed with some versions of Windows, or using the objdump program that's in the development tools put together by Brian Ripley, or using some tool that probably comes with VC. (With Borland compilers the tool is called tdump.exe, but I don't know what Microsoft calls it.) More help on using DLLs is on my web page, <http://www.stats.uwo.ca/faculty/murdoch/software/compilingDLLs> and in the readme.packages file distributed with R. Duncan Murdoch