00001 #include "behaviortree_cpp/utils/shared_library.h" 00002 #include "behaviortree_cpp/exceptions.h" 00003 00004 BT::SharedLibrary::SharedLibrary(const std::string& path, int flags) 00005 { 00006 load(path, flags); 00007 } 00008 00009 void* BT::SharedLibrary::getSymbol(const std::string& name) 00010 { 00011 void* result = findSymbol(name); 00012 if (result) 00013 return result; 00014 else 00015 throw RuntimeError( "[SharedLibrary::getSymbol]: can't find symbol ", name ); 00016 } 00017 00018 bool BT::SharedLibrary::hasSymbol(const std::string& name) 00019 { 00020 return findSymbol(name) != nullptr; 00021 } 00022 00023 std::string BT::SharedLibrary::getOSName(const std::string& name) 00024 { 00025 return prefix() + name + suffix(); 00026 }