I'm trying to pass a shared pointer into Obj-C via void* so it can keep a particular object and then delete it (via C++ function).
Does this work?
I'm fine for a better idea, but this seems like the fastest way to get a reference to a shared pointer. Just want to make sure my math isn't off on the malloc (as I don't often use it).
std::shared_ptr<AAA> shared_ptr = getSharedPointer();
std::shared_ptr<AAA>* ptr = malloc(sizeof(std::shared_ptr<AAA>));
*ptr = shared_ptr;
return ptr;