Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to include custom headers on top of generated cpp11.cpp? #216

Open
vspinu opened this issue Jul 30, 2021 · 4 comments · May be fixed by #251
Open

How to include custom headers on top of generated cpp11.cpp? #216

vspinu opened this issue Jul 30, 2021 · 4 comments · May be fixed by #251

Comments

@vspinu
Copy link
Contributor

vspinu commented Jul 30, 2021

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?

@jimhester
Copy link
Member

jimhester commented Jul 30, 2021

Put the declarations in mypkgname_types.h and it will be included in the generated header.

@bkietz
Copy link
Collaborator

bkietz commented Jul 30, 2021

@vspinu
Copy link
Contributor Author

vspinu commented Jul 30, 2021

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.

@vspinu vspinu closed this as completed Jul 30, 2021
@vspinu vspinu reopened this Nov 19, 2021
@vspinu vspinu closed this as completed Nov 19, 2021
@vspinu vspinu reopened this Nov 19, 2021
@vspinu
Copy link
Contributor Author

vspinu commented Nov 19, 2021

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.

vspinu added a commit to vspinu/cpp11 that referenced this issue Nov 23, 2021
@vspinu vspinu linked a pull request Nov 23, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants