Ask Your Question

Revision history [back]

Is it safe to pass cv::String accross DLL boundary (e.g. imwrite, imread)?

I've recently learnt that it's highly not recommended to pass any STL object across the shared library boundary, because their ABI is not standardized, and so if the library and the code that uses it are compiled with different compilers, the STL objects could be perceived differently (different byte order etc).

Some functions in OpenCV take const cv::String& as an argument (imread(), imwrite() etc), and here I see that cv::String is just a typedef to std::string.

So why aren't there any problems with using OpenCV as a shared library?