cpp11
cpp11 copied to clipboard
How to include custom headers on top of generated cpp11.cpp?
My function returns external_pointer<MyClass>. How can I get a definition of MyClass into cpp11.cpp?
I was hoping for a declaration like [cpp11:include] which I can put in front of some statement and it will be automatically included in cpp11.cpp. Is there such a thing?
Put the declarations in mypkgname_types.h and it will be included in the generated header.
See also: https://cpp11.r-lib.org/articles/converting.html#type-aliases-1
Great, thanks! Would be great if you could add a sentence to the docs of cpp_register about this. This is where people would search first for such info.
Put the declarations in mypkgname_types.h
This doesn't seem to work for cpp11::cpp_source. I have tried all possible combinations <filename>_types.h, types.h, <filename>_types.hpp, and types.hpp.