How to compile Phobos with other D code to create a shared library?

bachmeier no at spam.net
Wed Jun 2 23:23:58 UTC 2021


On Tuesday, 1 June 2021 at 18:18:35 UTC, data pulverizer wrote:
> Doing `Runtime.initialize` is working with Julia but not yet R, 
> I'm getting a clock/GLIBC error
>
> ```
> Error in dyn.load("rbasic.so") :
>   unable to load shared object 'code/rbasic.so':
>   lib/x86_64-linux-gnu/librt.so.1: undefined symbol: 
> __clock_nanosleep, version GLIBC_PRIVATE
> ```
>
> do I need to import anything else?

Are you aware of my embedr project, which handles all that for 
you, and does a lot of other stuff?

https://embedr.netlify.app

If you want to do it yourself, you can see the boilerplate you 
need to add to call a shared library from R here: 
https://bitbucket.org/bachmeil/embedr/src/bebf67e5b30cd4163214c7f44f9907e7d7490dc0/R/compile.R#lines-99

If you want to read the R manual, the relevant section is here:
https://cran.r-project.org/doc/manuals/r-release/R-exts.html#dyn_002eload-and-dyn_002eunload
If you don't do that, it's unlikely to work unless you get lucky. 
If you want to load foo.so, you need a corresponding R_init_foo 
function where you call Runtime.initialize.


More information about the Digitalmars-d-learn mailing list