Displaying 20 results from an estimated 400 matches similar to: "Linking to native routines in other packages"
2017 Dec 29
1
winbuilder warning message wrt function pointers
And remove the cast on the return value of R_GETCCallable. And check
that your function is found before using it.
#include <R.h>
#include <Rinternals.h>
#include <R_ext/Rdynload.h>
void bdsmatrix_prod4(int nrow, int nblock, int *bsize,
double *bmat, double *rmat,
int nfrail, double *y) {
DL_FUNC fun = NULL;
if (fun==NULL)
2017 May 09
2
registering Fortran routines in R packages
Dear list,
I?m trying to register Fortran routines in randtoolbox (in srt/init.c file), see https://r-forge.r-project.org/scm/viewvc.php/pkg/randtoolbox/src/init.c?view=markup&root=rmetrics.
Reading https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Registering-native-routines and looking at what is done in stats package, I first thought that the following code will do the job:
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,
2007 Jun 01
1
Calling C routine in anther package in C code (R_RegisterCCallable)
Hi,
I want to make use of some C routines from other packages to write extensions
in C.
In "Writing R Extensions", it says there is an experimental interface to
support this in (or from ?) R 2.4.0.
I had a dummy library containing src/dummy.cpp and R/zzz.R:
====== src/dummy.cpp ====
#include <R.h>
#include <Rinternals.h>
#include <R_ext/Rdynload.h>
2017 May 10
3
registering Fortran routines in R packages
Thanks for your email.
I try to change the name in lowercase but it conflicts with a C implementation also named halton. So I rename the C function halton2() and sobol2() while the Fortran function are HALTON() and SOBOL() (I also try lower case in the Fortran code). Unfortunately, it does not help since I get
init.c:97:25: error: use of undeclared identifier 'halton_'; did you mean
2017 Jan 13
1
calling native routines in another package (Sec 5.4.2 of Writing R Extensions)
I just (apparently) figured out how to do the stuff described in
Section 5.4.2 of
Writing R Extensions. I put my test toy packages on github
<https://github.com/cjgeyer/linkingTo> for anyone to copy. If anyone
cares to read the README and the bits of code it links to and tell me
anywhere I am wrong, I would be grateful.
But the main point of this e-mail is a complaint about that section
2017 Dec 29
3
winbuilder warning message wrt function pointers
I've recently updated the coxme package, which calls internal routines from the bdsmatrix
package.? (It is in fact mentioned as an example of this in the Extensions manual.)
The call connections are a blocks like this, one for each of the 9 called C routines.
void bdsmatrix_prod4(int nrow,??? int nblock,?? int *bsize,
??????????????????? double *bmat, double *rmat,
??????????????????? int
2017 Dec 29
0
winbuilder warning message wrt function pointers
You can legally cast a function pointer to another function pointer, where
the signatures differ. (It is not legal to cast between data and function
pointers.)
I would make typedefs for the various signatures, as the casting syntax is
more
readable then.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Fri, Dec 29, 2017 at 10:13 AM, Therneau, Terry M., Ph.D. <
therneau at mayo.edu> wrote:
2012 Feb 06
1
Segfault on ".C" registration via R_CMethodDef according to 'Writing R Extensions'.
Dear R List,
I encountered a serious problem regarding the registration of ".C" when following the documentation "Writing R Extensions"
that leads to a segmentation fault (tested on windows and mac os x).
The registration mechanism for ".C" routines via R_registerRoutines and
the R_CMethodDef structure has been enhanced recently with the
addition of two fields, one
2003 Oct 10
1
number of arguments in .Call function registration
I initially sent this to the biocore mailing list - but it was
suggested that r-devel would also find it interesting.
Many of us use a macro like
#define CALL_DEF(fname, nargs) { #fname, (DL_FUNC)&fname, nargs}
for use in function registration for use with .Call.
For example, using the example from R Extension manual,
if we want to register a C function myCall with three arguments, we
2017 May 10
1
registering Fortran routines in R packages
Have you tried using tools:::package_native_routine_registration_skeleton()? If you don't like its output, you can easily edit its results and still avoid most pitfalls.
Cheers, Jari Oksanen
________________________________________
From: R-devel <r-devel-bounces at r-project.org> on behalf of Berend Hasselman <bhh at xs4all.nl>
Sent: 10 May 2017 09:48
To: Christophe Dutang
Cc:
2009 Jan 08
1
Callbacks seems to get GCed.
Dear list,
I am trying to implement a publish-subscribe mechanism in for an embedded
R interpreter. But somehow my registered closures seem to get collected by
the GC, even though I have protected them. I have reducted my code to the
following sample. Sorry if it is a little verbose.
The first couple of call of calls still work, but at some point one of the
callbacks (callback1 in my
2017 May 09
0
registering Fortran routines in R packages
> On 9 May 2017, at 13:44, Christophe Dutang <dutangc at gmail.com> wrote:
>
> Dear list,
>
> I?m trying to register Fortran routines in randtoolbox (in srt/init.c file), see https://r-forge.r-project.org/scm/viewvc.php/pkg/randtoolbox/src/init.c?view=markup&root=rmetrics.
>
> Reading
2003 Oct 21
2
Problem R-1.8.0 library tcltk on Tcl-8.0.5 (PR#4699)
Full_Name: Eiji Nakama
Version: R-1.8.0
OS: linux(VineLinux)
Submission from: (NULL) (219.117.236.13)
I build by Tcl8.0.5 and R-1.8.0.
> library(tcltk)
Error in dyn.load(x, as.logical(local), as.logical(now)) :
unable to load shared library "/usr/lib/R/library/tcltk/libs/tcltk.so":
/usr/lib/R/library/tcltk/libs/tcltk.so: undefined symbol:
RTcl_ActivateConsoleError in
2020 Apr 17
3
Demo for linking native routines between R packages
Dear Davis,
Thank you a lot for sharing this, and I am happy that I was not the only
one who need to do it once to learn:)
I proposed to add my repo to the manual. I think it makes sense to add both
of ours, if possible, or we could merge them together and add that to the
manual.
Long-term URL stability is apparently an issue, but I think we may find a
solution there.
Anyway, thanks a lot for
2017 Dec 29
0
winbuilder warning message wrt function pointers
Try changing
static void (*fun)() = NULL;
to
DL_FUNC fun = NULL;
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Fri, Dec 29, 2017 at 5:14 AM, Therneau, Terry M., Ph.D. <
therneau at mayo.edu> wrote:
> I've recently updated the coxme package, which calls internal routines
> from the bdsmatrix package. (It is in fact mentioned as an example of this
> in the Extensions
2003 May 16
1
Reloading a shared library with dyn.load
Hi,
I'm using dyn.load to load a shared library (compiled from C
code) into R. If I dyn.unload it and then dyn.load it again, I
get an hourglass icon in Rgui (R 1.7.0, Win 2000), and it
just sits there forever. I can't press Escape to stop the
current computation, but I can close Rgui without resorting to
using the Task Manager.
Is it a problem with my use of R_alloc? Do I need
2007 May 01
1
Embedding R and registering routines
Hello,
The use of .Call and the like all depend on loading shared libraries and
registering routines from it. Also, .Primitive and .Internal depend on
routines being registered in the R binary. And applications that embed R
can override routines declared in Rinterfac.h, but is there a way for an
application embedding R to register other routines defined in the
application without loading a
2003 Dec 09
1
R Interface handholding
Hello,
I need a bit of handholding with R, specifically, with writing
packages for it. I'm a systems programmer, and am, on the request
of several users of our software, working on generating R interfaces.
For starters, I've written the following R function (which compiles):
SEXP myincr(SEXP Rinput)
{ // Returns input integer incremented by one
int input;
SEXP returner;
PROTECT(Rinput =
2020 Apr 17
1
Demo for linking native routines between R packages
Dear Davis and Dirk,
Thank you very much for the suggestions, which are very valuable and
helpful.
I will add references to prior examples, document my project with the clear
step-by-step-style document of Davis's project, and come back again to the
mailing list.
Best wishes,
David
On Fri, Apr 17, 2020 at 3:40 PM Dirk Eddelbuettel <edd at debian.org> wrote:
>
> Jitao,
>