jeudi 25 février 2016

Passing shared_ptr to shared object/dll

Suppose I pass a std::shared_ptr from a method func to a so/dll function dll_func, which in turn pushes it into a private dll vector.

Then dll_func returns, and func returns as well, so that the std::shared_ptr in the dll vector is the only std::shared_ptr instance.

If later on the dll clears the vector, the std::shared_ptr in there is deallocated by the dll or by the calling program that initially created the std::shared_ptr?

Aucun commentaire:

Enregistrer un commentaire