DynamicLibrary.h 572 B

12345678910111213141516171819202122232425262728293031323334
  1. #pragma once
  2. #include <ATen/Utils.h>
  3. #include <c10/macros/Export.h>
  4. #include <c10/util/Exception.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(
  14. const char* name,
  15. const char* alt_name = nullptr,
  16. bool leak_handle = false);
  17. TORCH_API void* sym(const char* name);
  18. TORCH_API ~DynamicLibrary();
  19. private:
  20. bool leak_handle;
  21. void* handle = nullptr;
  22. };
  23. } // namespace at