Displaying 20 results from an estimated 1000 matches similar to: "Calling function with proto in Rinternals.h"
2013 May 24
1
Problem with Rboolean in c++ code
I am trying to use R_RegisterCFinalizerEx to ensure some c++ object is
properly deleted after use. However, I run into some problems when
trying to pass in the third argument which is an Rboolean. The line
'R_RegisterCFinalizerEx(p, finalizer, TRUE);' generates the following
error when trying to compile using R CMD SHLIB:
g++ -I/usr/share/R/include -DNDEBUG -fpic -O2 -pipe
2004 May 03
1
Finalization and external pointers
I'm adding things to the Windows RGui so that there's more control of
the interface from within R.
One thing I'm considering is giving access to the Graphapp window
objects using external pointers. This raises the issue of
finalization on both sides:
- If someone creates a pointer referring to a window, then that
pointer should be changed to NULL when the window is closed.
- If
2007 Mar 19
3
Rinternals.h and undefined symbols
Hi,
I'm trying to register my native routines using R_registerRoutines
(...). I can compile the code, but the loader cannot resolve the symbol:
undefined symbol:
_Z18R_registerRoutinesP8_DllInfoPK12R_CMethodDefPK15R_CallMethodDefS3_S6
_
$ nm bgx.Rcheck/bgx/libs/bgx.so | grep R_registerRoutines
U
_Z18R_registerRoutinesP8_DllInfoPK12R_CMethodDefPK15R_CallMethodDefS3_S6
2020 Apr 03
4
The finalizer of the externalPtr does not work when closing R?
Hi all,
I found that the finalizer of the externalPtr is not called when R is
quitting. However, manually calling GC() works fine. This behavior is
observed on devel R 2020-04-02 r78142 on Win and R 3.6.3 on Ubuntu. I make
a reproducible package here: https://github.com/Jiefei-Wang/example
Here is the detail of how to reproduce the problem, I create a temporary
file in the package root path and
2002 Nov 07
0
Finalizer function?
I have some code that calls R's finalizer interface, e.g.,
.Call('R_RegisterFinalizerEx', object, function, TRUE)
This worked pre 1.6, but now I get '.Call function name not in call
table'. Are functions listed in Rinternals.h no longer available in
.Call? Or is this a namespace issue? How do I reference the function?
Thanks.
Tim
--
Timothy H. Keitt
The University of
2001 Jul 10
1
Object finalization
I see some code in R to attach finalizers to external pointer references
(Register[C]Finalizer). Anyone have an example of how to code the
finalizer? R_RegisterCFinalizer accepts a C function, but I can't see
how to get it to operate on the pointer, since the pointer is not passed
to the function when its called. RegisterFinalizer takes an R closure,
but how is it called from R (tried
2007 Feb 25
3
R/C++/memory leaks
Dear all,
I have wrapped a C++ function in an R package. I allocate/deallocate
memory using C++ 'new' and 'delete'. In order to allow user
interrupts without memory leaks I've moved all the delete statements
required after an interrupt to a separate C++ function freeMemory(),
which is called using on.exit() just before the .C() call.
I am concerned about the
2019 May 19
4
most robust way to call R API functions from a secondary thread
Hi,
As the subject suggests, I am looking for the most robust way to call an (arbitrary) function from the R API from another but the main POSIX thread in a package's code.
I know that, "[c]alling any of the R API from threaded code is ?for experts only? and strongly discouraged. Many functions in the R API modify internal R data structures and might corrupt these data structures if
2005 Apr 02
2
Building new graphic device drivers with g++
Dear Group,
I'm trying to build a set of new graphic device drivers. I use the
devNull example a a beginning point:
$ R CMD SHLIB devNull.c
gcc -shared -L/usr/local/lib -o devNull.so devNull.o
(everything works OK)
$ R CMD SHLIB devNull.cpp
g++ -shared -L/usr/local/lib -o devNull.so devNull.o
(everything works OK)
The difficulties start when trying to compile manually. I compile the
2005 Jul 26
1
Error registering finalizer
What exactly is a reference object? I'm getting this error
message attempting to register a finalizer:
can only weakly reference/finalize reference objects
I don't see any problem with the code... Here's what appears
to be the relevant portions.
setClass("PDNNObject",
representation(handle = "externalptr",
id =
2011 Feb 11
1
Writting my own package - 64 bit problem with R_GetCCallable
Hello list,
I've been working on a package of my own. It works fine on the 32bit
linux machines that I've tested it on. Someone using 64bit ubuntu
wanted to try it, and surprising segfaults happened. My test code
results in no segfault, errors, or leaks from my calls when run under
valgrind (I recompiled R with the level 2 valgrind instruments). R
and packages are compiled from source,
2016 Jan 27
2
rstan warning messages
Confirmed that gcc-gfortran is installed
Package gcc-gfortran-4.4.7-16.el6.x86_64 already installed and latest version
What could I check next?
I do not have the following installed and will get that done and tested again.
libcurl-devel
libidn-devel
Thanks,
Larry
-----Original Message-----
From: Tom Callaway [mailto:tcallawa at redhat.com]
Sent: Wednesday, January 27, 2016
2006 Feb 08
1
Rf_protect in Rinternals.h
Hello!
I'd like to ask you a question about c (macros):
In Rinternals.h are defined:
a) SEXP Rf_protect(SEXP);
b) #define protect Rf_protect
c) #define PROTECT(s) protect(s)
As far as I understand the calls Rf_protect( x ), protect( x ) and
PROTECT( x ) are all equalent.
So whats the reason that there are 2 macros defined? Why 3 times the
same when 1 distinct function would be
2014 Aug 22
1
what are labels in struct sxpinfo_struct from Rinternals.h mean?
Dear Rdevelers,
? ? ?The following struct is in the Rinternals.h. I want to know ?the meanings of labels or names like "gp,mark,obj,named,trace....." . TKS!
struct sxpinfo_struct {
? ? SEXPTYPE type ? ? ?: ?5;/* ==> (FUNSXP == 99) %% 2^5 == 3 == CLOSXP
? ? * -> warning: `type' is narrower than values
? ? * ? ? ? ? ? ? ?of its type
? ? * when SEXPTYPE was an enum
2004 Feb 11
1
About the macro defined in Rinternals.h
Hello everyone,
I try to write a c++ code which calls embedded R and uses some of R
internal functions. What I read is just lots of macro names defined in
the Rinternals.h or Rdefines like R_Parse, Rf_install and so on. But
where can I get the detailed information about the parameters of these
macro? For example, what about the parameters of SEXP
R_ParseVector(SEXP, int, ParseStatus *)?
2009 Sep 03
1
Running an expression 1MN times using embedded R
Hello,
I'm evaluating this expression
expression({ for(x in 1:5){ .Call('rh_status','x') }})
a million times from a program with R embedded in it. I have attached
reproducible code that crashes with
Program received signal SIGSEGV, Segmentation fault.
0x00002b499ca40a6e in R_gc_internal (size_needed=0) at memory.c:1309
1309 FORWARD_NODE(R_PPStack[i]);
Current language:
2013 Nov 03
1
on.exit() & sys.on.exit(): Calling them via eval() does not work as hoped
Why does the following eval() call on sys.on.exit() not return what I
expect/evaluate in the proper environment?
foo <- function() {
cat("foo()...\n");
on.exit( message("exiting") )
cat("sys.on.exit():\n")
res <- sys.on.exit()
print(res)
cat("eval(sys.on.exit()):\n")
expr <- quote(sys.on.exit())
print(expr)
res <- eval(expr)
2007 Apr 06
2
wishlist: additional argument in R_tryEval (Rinternals.h)
Hi,
R_tryEval, exported in Rinternals.h but not part of the API, is
currently defined as:
R_tryEval(SEXP e, SEXP env, int *ErrorOccurred);
I'm trying to embed R in an application (basically yet another GUI),
and this has been very helpful to catch errors. It would be even more
helpful if it also gave access to the visibility flag. I can wrap this
in a call to withVisible, and that works
2007 May 30
5
Possible changes to connections
When I originally implemented connections in R 1.2.0, I followed the model
in the 'Green Book' closely. There were a number of features that forced
a particular implementation, and one was getConnection() that allows one
to recreate a connection object from a number.
I am wondering if anyone makes use of this, and if so for what?
It would seem closer to the R philosophy to have
2010 Aug 23
1
Speeding up sum and prod
Looking for more ways to speed up R, I've found that large
improvements are possible in the speed of "sum" and "prod" for long
real vectors.
Here is a little test with R version 2.11.1 on an Intel Linux system
> a <- seq(0,1,length=1000)
> system.time({for (i in 1:1000000) b <- sum(a)})
user system elapsed
4.800 0.010 4.817
> system.time({for (i