r-lib / cpp11

cpp11 helps you to interact with R objects using C++ code.
https://cpp11.r-lib.org/
Other
193 stars 46 forks source link

`SEXP` vs. `void *` #351

Closed krlmlr closed 5 months ago

krlmlr commented 5 months ago

At some point, tools::package_native_routine_registration_skeleton() changed the generated prototypes to void * from SEXP . I couldn't find a NEWS entry.

This has implications when the function's definition lives in a C++ file with extern "C" and uses SEXP, and (apparently) SEXP means something other than void * in that translation unit. My igraph 2.0.0 release came back with an LTO error (-Wodr) because of this mismatch, fixed with igraph/rigraph@9dc6ba474ebf73b5a027488719c3fe000775373b.

I agree that this is a corner case of a corner case, and the solution is simple. I'm still confused why the change to void * happened. I wonder if maybe cpp11 should do something about it, and again, the answer is likely "no".

krlmlr commented 5 months ago

Bottom line: