DynamicLibrary.h 553 B

12345678910111213141516171819202122232425262728293031
  1. #pragma once
  2. #include <c10/macros/Export.h>
  3. #include <c10/util/Exception.h>
  4. #include <ATen/Utils.h>
  5. namespace c10 {
  6. class DynamicLibraryError : public Error {
  7. using Error::Error;
  8. };
  9. } // namespace c10
  10. namespace at {
  11. struct DynamicLibrary {
  12. AT_DISALLOW_COPY_AND_ASSIGN(DynamicLibrary);
  13. TORCH_API DynamicLibrary(const char* name, const char* alt_name = nullptr, bool leak_handle = false);
  14. TORCH_API void* sym(const char* name);
  15. TORCH_API ~DynamicLibrary();
  16. private:
  17. bool leak_handle;
  18. void* handle = nullptr;
  19. };
  20. } // namespace at