Open JosiahParry opened 2 months ago
~It should not work like this if I am not mistaken, the contents of extendrsrc
go into a generated rust function.~
It could also be that it does not understand macros (which is definitely on another level).
Its worth noting that it does compile the macro iff #[extendr]
is not present and it can even be called later down (pretty neat)!
Ok I get it. The issue here is two-fold. We generate exports based on simple scanning for #[extendr]
attribute. Here we find it in the macros. We do not do macros expansion so it captures macros declaration verbatim, which is garbage in this case (because of function name interpolation). We can solve it as follows:
##[extendr]
to disable metadata capture (and replace all of these with #[extendr]
before compiling)extendr
export block explicitly (like you do in package code)
Error in
purrr::map2()
: ℹ In index: 1. Caused by error inextract_meta()
: ! Rust code contains invalid attribute macros. • ✖ No validfn
orimpl
block found in the following sample: • #[extendr] • fn $fn_name(x: Strings) -> Strings { •Backtrace:
Execution halted