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