RE: STL Containers and __declspec(export/import)
Vasco Lohrenscheit <[email protected]> Mon, 07 Feb 2005 01:28:23 +0100
| Newsgroups | gmane.games.devel.windows |
|---|---|
| Message-ID | <[email protected]> |
At 00:47 07.02.2005, you wrote: >Your guess is correct. > >Exporting the STL containers is a Bad Thing(tm). > >Implementations of the STL are not necessarily binary compatible. There is >no convenient way to translate between different implementations, so if the >DLL uses a different version than your executable, the objects will differ >and your program will fail. afaik this is a general problem of c++ (no general C++ ABI, see also http://aegisknight.org/cppinterface.html ), so in principle the same applies to normal c++ objects. >Vectors are a special case. The latest versions of the C++ standard have a >guarantee that vectors are contiguous, and all major implementations before >that guarantee also have that behavior, so passing vectors around as general >arrays can be done safely. > >I seem to remember also that the VC++ 7.1 uses local storage in the >implementation, so in that case, even moving between the same implementation >would fail if you crossed EXE/DLL boundaries. Not if you link all your modules to the DLL runtime, again all with the same version. I use lots of stl and boost with my DLLs. As long as you make sure that all components are compiled with same compiler (+ same version) and linked with the runtime DLL it works without any problems. Otherwise it really gets involved: only C functions and pure abstract C++ types allowed and seperated memory managment between modules. Vasco ------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ Gamedevlists-windows mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=555