[cpp11] <pkg>_type.h, linking to, etc.

I am curious about how I can use cpp11 to make a package that others can link to and call my registered functions from their compiled code. Also, I would like custom types in this interface. Mostly, I am asking to see what people are currently doing and best practices. Browsing the cpp11 code, I see you can expose new types in inst/include/<pkg>_types.h[pp]. I assume I can make a inst/include/<pkg>.h file and include the types header. Can cpp11 fill out the <pkg>.h or does that need to be done manually?

Also, I have something like:

#include <cpp11.h> // needed because new types depend on this
#include <some_external_types.h> // new types depend on these
void custom_deleter(void*);
using my_custom_type = cpp11::external_pointer<external_type, custom_deleter>;

in my <pkg>_types.h file. It seems including cpp11.h here causes problems. Anyway, I'd be grateful if folks involved with cpp11 could tell me if I'm on the right track or should revise. Thanks.

This topic was automatically closed after 45 days. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.