On 24 May 2023 at 09:09, Ivan Krylov wrote:
| On Wed, 24 May 2023 02:08:25 +0200
| wrote:
| > Is there a better way to do this?
|
| The .Call() interface (where functions take an arbitrary number of
| native R objects and return a native R object) combined with external
| pointers is likely to
You could try {constructive} : https://github.com/cynkra/constructive/
Here's how it might help:
```
E <- new.env()
fun <- function(x) x
environment(fun) <- E
O <- list(
a = 1,
b = fun
)
# remotes::install_github("cynkra/constructive")
library(constructive)
construct(E)
#>
On Wed, 24 May 2023 02:08:25 +0200
wrote:
> initialize = function() {
>
> .C("make_native_obj", self$native_obj)
>
> })
> extern "C" void make_native_obj(double *obj) {
>
> auto native_obj = new NativeObjStruct();
>
> memcpy(obj, _obj, sizeof(obj));
>
> }
> Is there a better