Is it good practice to use std::move over a DLL boundary?
c++, c++11, dll
Solution
In general, the only objects that should cross DLL boundaries are objects who's destructors (and copy constructors/assignments) don't do much. Preferably, one should only use PODs for maximum safety (thus allowing two DLLs to interface even though they weren't compiled with the exact same version of the exact same compiler).
As to what happens with the move, yes, the receiving DLL will deallocate memory allocated by the providing DLL. Which generally falls under the "not good" camp.
If you want to make it safe, you could use special allocators that allocate (and deallocate) memory from the receiving DLL. But that's generally annoying.
Problem
As anyone who has used DLLs on Windows will tell you, it's a bad idea to `new` an object on one side of a DLL boundary and then `delete` it on the other. Generally one uses factory methods with DLLs to avoid this so that the object code to perform the new/delete occurs in the same object file. Today, I was designing a new interface where I wanted to `std::move` a `std::vector<std::wstring>` from one object to another where the objects were created in different DLLs. I was all set to do this when it occurred to me that this may mean that the `delete` may now occur in different object code than the `new` did since a different object now owns the underlying pointer. Can anyone confirm if this is the case?