Created
February 17, 2015 22:15
-
-
Save jjallaire/bfc84ce7dd566a0a7231 to your computer and use it in GitHub Desktop.
custom finalizer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Rcpp.h> | |
using namespace Rcpp; | |
void finalizeInt(int* ptr) { | |
// do nothing | |
} | |
typedef XPtr<int,PreserveStorage,finalizeInt> XPtrInt; | |
// [[Rcpp::export]] | |
XPtrInt test() { | |
return XPtrInt(new int(10)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this! I've been trying to get custom finalizers working for the past hour, and the
PreserveStorage
was all I needed! I suspect you also need to have thetrue
flag forset_delete_finalizer
.