jeudi 23 mai 2019

Is it possible to transfer ownership from a void* to a unique_ptr?

I am currently using the dlopen functions for some plugin project.
This function handle returns a void* and then I save all the handle to a map named handles:

void* handle = dlopen(path.c_str(), RTLD_LAZY);  
handles[file] = handle;

My goal is to pass the ownership to the map, I was thinking of a unique_ptr, but not sure if this is even possible.

If it's not possible what other alternatives do I have ?

Aucun commentaire:

Enregistrer un commentaire