Calling function C from R, skip the opaque pointer

I read several guides on calling C functions from R, but none of these examples shows how to pass / return an opaque pointer to C. That is, suppose I have a C API, for example

struct foo *foo_new();
void foo_destroy(struct foo *);

How can I introduce such an API for R?

+4
source share
1 answer

I believe that when calling C functions, only limited argument types are supported.

According to the manual:

R storage mode  C type          FORTRAN type

logical         int *           INTEGER
integer         int *           INTEGER
double          double *        DOUBLE PRECISION
complex         Rcomplex *      DOUBLE COMPLEX
character       char **         CHARACTER*255
raw             unsigned char * none
0
source

Source: https://habr.com/ru/post/1611998/


All Articles