1 /*========================== begin_copyright_notice ============================ 2 3 Copyright (C) 2017-2021 Intel Corporation 4 5 SPDX-License-Identifier: MIT 6 7 ============================= end_copyright_notice ===========================*/ 8 9 #include "cif/os/lin/lin_library_handle.h" 10 11 namespace CIF { 12 OpenLibrary(const std::string & path,bool addOsSpecificExtensionToPath)13std::unique_ptr<LibraryHandle> OpenLibrary(const std::string &path, bool addOsSpecificExtensionToPath) { 14 void *mod = nullptr; 15 if(addOsSpecificExtensionToPath){ 16 mod = dlopen((path + ".so").c_str(), RTLD_NOW); 17 }else{ 18 mod = dlopen(path.c_str(), RTLD_NOW); 19 } 20 return OpenLibrary(UniquePtrLibrary(mod)); 21 } 22 OpenLibrary(const std::wstring & path,bool addOsSpecificExtensionToPath)23std::unique_ptr<LibraryHandle> OpenLibrary(const std::wstring &path, bool addOsSpecificExtensionToPath) { 24 std::string pathAsString(path.begin(), path.end()); 25 return OpenLibrary(pathAsString, addOsSpecificExtensionToPath); 26 } 27 } 28