BsDynLibManager.h 870 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #pragma once
  2. #include "BsPrerequisitesUtil.h"
  3. #include "BsModule.h"
  4. namespace BansheeEngine
  5. {
  6. /**
  7. * @brief This manager keeps a track of all the open dynamic-loading
  8. * libraries, opens them and returns references to already-open
  9. * libraries.
  10. *
  11. * @note Not thread safe.
  12. */
  13. class BS_UTILITY_EXPORT DynLibManager : public Module<DynLibManager>
  14. {
  15. public:
  16. DynLibManager();
  17. virtual ~DynLibManager();
  18. /**
  19. * @brief Loads the given file as a dynamic library.
  20. *
  21. * @param filename The name of the library. The extension can be omitted
  22. */
  23. DynLib* load(const String& filename);
  24. /**
  25. * @brief Unloads the given library.
  26. */
  27. void unload(DynLib* lib);
  28. protected:
  29. Map<String, DynLib*> mLoadedLibraries;
  30. };
  31. BS_UTILITY_EXPORT DynLibManager& gDynLibManager();
  32. }