search for: getnativesymbolinfo

Displaying 20 results from an estimated 28 matches for "getnativesymbolinfo".

2011 Aug 17
3
getNativeSymbolInfo("user_unif_rand") returns different results on windows and linux
Hi, When loading a package that provides the user-supplied RNG hook user_unif_rand, calling getNativeSymbolInfo("user_unif_rand") returns informations about the loaded symbol. I am using this to identify which package currently provides the RNG hook. The results are the same on windows and linux if only one library provides the hook. If one loads a second package that provides this hook, then on...
2008 Apr 09
1
getNativeSymbolInfo fails with Fortran symbol.
...19) common /myparms/pars call odeparms(19, pars) return end $ R CMD SHLIB Aquaphy.f gfortran -fpic -g -O2 -c test.f -o test.o gcc -std=gnu99 -shared -L/usr/local/lib -o test.so test.o -lgfortran -lm and linked into the package dll (or so). Help for is.loaded() and getNativeSymbolInfo() say not to use symbol.For() to convert to Fortran-specific symbols. However, on Linux, getNativeSymbolInfo is unable to find 'initaquaphy' in 'test.so', but does find 'initaquaphy_'. Note that is.loaded() works as advertised. Furthermore, this code works in Windows, R-2...
2004 Sep 20
1
problem typcasting return of R_ExternalPtrAddr(SEXP s)
In the odesolve routine lsoda(), I allow the function (named func) that calculates the system of differential equations to be defined in a dll that has been dynamically loaded from the file named in dllname. I use getNativeSymbolInfo(func, dllname)$address to get the address of the function and pass it to a C function called via the .Call interface. Inside that C function, I use R_ExternalPtrAddr(deriv_func) to get the function pointer. This requires typcasting the return value of R_ExternalPtrAddr from (void *) to (deriv_f...
2012 Jan 24
2
Calling function in DLL using .C
...unctions 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 element...
2024 May 30
1
How to call directly "dotTcl" C-function of the tcltk-package from the C-code of an external package?
I asked Tomas. Apparently this works: getNativeSymbolInfo("dotTcl",PACKAGE=getLoadedDLLs()$tcltk) and the tcltk behavior was changed by r84265 | hornik | 2023-04-15 08:44:36 +0200 (Sat, 15 Apr 2023) | 1 line Try forcing symbols in ff calls. Index: library/tcltk/src/init.c ===================================================================...
2009 Feb 04
1
Foreign function call
...think it this can be answered then I can translate the information to other calls. In the arima 'R' code there is a reference to .Call(R_TSconv, a, b) If from the console I type: > .Call(R_TSConv, c(1,-1), c(1,-1)) I get: Error: object "R_TSConv" not found If I do > getNativeSymbolInfo("R_TSConv") I get: Error in FUN("R_TSConv"[[1L]], ...) : no such symbol R_TSConv What am I missing? Thank you. Kevin
2024 May 28
1
How to call directly "dotTcl" C-function of the tcltk-package from the C-code of an external package?
...e a use case with tcltk-package where I need to repeatedly call Tcl/Tk functions very quickly. For such purpose, the standard R-interface turned out to be too slow, and better option has been to call package's C-function dotTcl directly from my own C-code. Before R 4.4.0 it was possible to use getNativeSymbolInfo("dotTcl","tcltk")$address (or R_FindSymbol("dotTcl","tcltk",NULL) in C) to get the function-pointer and then call the function directly, even though it has not been registered as C-callable for other packages. With R 4.4.0 these methods are unable to find t...
2006 Mar 15
1
multiple packages using the same native code.
This might fall under the purview of bundles, but I could not find any example bundles which demonstrated what I am after. I would like to construct two packages (A, B) which utilize a number of common C functions. The most straightforward way to do this is just copy the relevant .c and .h files from one src directory to the next, but this is tedious especially in the face of multiple
2007 Jun 08
1
Question about Running C code from R
...access these functions from R, however. Here's the R code I've written (simplecall.r), which I've put together from various websites and guesses: *********************************************************************************************** dll=dyn.load("Project1.exe") syms=getNativeSymbolInfo(c("Rc","Rc2"),dll) RcInR=function(x) { .Call(dll$Rc,as.numeric(x)) } Rc2InR=function(x) { .Call(dll$Rc2,as.numeric(x)) } i1=4;j1=Rc(i1) cat("\nUsing Rc from R: ",i1,"+3=",j1," - OK so far.\n") m1=6;n1=Rc2(m1) cat("\nUsing Rc2 from R: &quo...
2016 Jun 30
2
Calling C implementations of rnorm and friends
...l them as: .Call(C_rnorm, 1, 1, 1) This doesn't work because R assumes C_rnorm is an object. Looking at the documentation for .Call, I try passing it in as a string: .Call("C_rnorm", 1, 1, 1, PACKAGE = "stats") This doesn't work either. The help page links to getNativeSymbolInfo(), which I can't make work either. It also refers me to the dyn.load() function and the "Writing R Extensions" manual. After reading and trying to digest those, I try getDLLRegisteredRoutines("stats") which shows me all the C and Fortran functions as registered routi...
2001 Dec 13
3
R-1.4.0: how to use getSymbolInfo()?
I have a package that solves systems of ordinary differential equations coded as an R function (odesolve, on CRAN). The function is passed to R code, and c and Fortran code called by it uses lang4() and eval() to evaluate the R function inside a compiled c function to use in a compiled ODE solver. This works quite well, but can be slow. I'd like to be able to supply the name of a compiled
2016 Jul 01
2
Calling C implementations of rnorm and friends
...is doesn't work because R assumes C_rnorm is an object. Looking at the >> documentation for .Call, I try passing it in as a string: >> >> .Call("C_rnorm", 1, 1, 1, PACKAGE = "stats") >> >> This doesn't work either. The help page links to getNativeSymbolInfo(), >> which I can't make work either. It also refers me to the dyn.load() >> function and the "Writing R Extensions" manual. >> >> After reading and trying to digest those, I try >> >> getDLLRegisteredRoutines("stats") >> >&g...
2012 Jan 09
1
serializing recordedplot object
I use recordPlot() to save plots to disk that I render later to a variety of formats. This works fine for base R plots and ggplot2 plots, and also used to work for lattice plots. However somewhere in version 2.14 things stopped working for lattice plots. Here is an example: library(lattice); histogram(rnorm(100)); x <- recordPlot(); saveRDS(x, "myplot.rds"); y <-
2012 May 24
1
modifying some package code
Greetings, I am working on modifying some code from the nlme package. I have had many discussions on the mixed models mailing list and have been directed to simply 'hack' the source code to have the degrees of freedom generated by one function to use in the output of another function that doesn't generate them. My current holdup is an error regarding a .c file called
2012 May 24
1
inner_perc_table?
Hello, Does anyone on this list know what inner_perc_table is or where it is typically found? I am trying to modify some source code and it is used with the .C() function. When I try and run it, it states that 'inner_perc_table is not found'. It is only called in such a way and isn't defined at any point in the previous code in which the function works. Should this be in some other
2016 Jun 30
0
Calling C implementations of rnorm and friends
..., 1, 1) > > This doesn't work because R assumes C_rnorm is an object. Looking at the > documentation for .Call, I try passing it in as a string: > > .Call("C_rnorm", 1, 1, 1, PACKAGE = "stats") > > This doesn't work either. The help page links to getNativeSymbolInfo(), > which I can't make work either. It also refers me to the dyn.load() > function and the "Writing R Extensions" manual. > > After reading and trying to digest those, I try > > getDLLRegisteredRoutines("stats") > > which shows me all the C and...
2016 Jul 01
1
Calling C implementations of rnorm and friends
...n object. Looking at > the > >>> documentation for .Call, I try passing it in as a string: > >>> > >>> .Call("C_rnorm", 1, 1, 1, PACKAGE = "stats") > >>> > >>> This doesn't work either. The help page links to getNativeSymbolInfo(), > >>> which I can't make work either. It also refers me to the dyn.load() > >>> function and the "Writing R Extensions" manual. > >>> > >>> After reading and trying to digest those, I try > >>> > >>> getDL...
2016 Jul 01
0
Calling C implementations of rnorm and friends
...because R assumes C_rnorm is an object. Looking at the >>> documentation for .Call, I try passing it in as a string: >>> >>> .Call("C_rnorm", 1, 1, 1, PACKAGE = "stats") >>> >>> This doesn't work either. The help page links to getNativeSymbolInfo(), >>> which I can't make work either. It also refers me to the dyn.load() >>> function and the "Writing R Extensions" manual. >>> >>> After reading and trying to digest those, I try >>> >>> getDLLRegisteredRoutines("stat...
2007 Jul 21
2
dict package: dictionary data structure for R
Hi all, The dict package provides a dictionary (hashtable) data structure much like R's built-in environment objects, but with the following differences: - The Dict class can be subclassed. - Four different hashing functions are implemented and the user can specify which to use when creating an instance. I'm sending this here as opposed to R-packages because this package will
2002 Sep 06
3
explict sharing of symbols between packages
Hi everyone, I'm thinking about breaking up a large package I have to avoid loading some of the more specialised parts when it isn't necessary. The package is dependent on shared libraries. The base one will keep all of the core stuff like constructors etc and the specialised parts will need to access these. It is obviously possible to set the "local" flag to false, however