Open andyjsbell opened 4 years ago
Yeah, cpp_class
only work with class that are relocatable.
This is documented there: https://docs.rs/cpp/0.5.5/cpp/macro.cpp_class.html#relocatable-classes
Perhaps the documentation should be more explicit, or extra warning should be in order.
I decided to test this out on OSX and Windows. Interestingly both Windows and OSX did not have the issue.
This depends on the implementation of the standard library.
Hi, out of curiosity, why test
is relocatable immediately ? it is used only once.
Internally it is returned from the Test::new()
function so that's one possible relocation (even if it might be optimized)
Also internally in the cpp! macro
Using the cpp_class! macro with a simple class aborts on freeing the resource. This is happening on Ubuntu 1804. Code snippet reproducing the issue: