PothosUtilLoadModule.cpp 711 B

123456789101112131415161718192021222324252627
  1. // Copyright (c) 2013-2015 Josh Blum
  2. // SPDX-License-Identifier: BSL-1.0
  3. #include "PothosUtil.hpp"
  4. #include <Pothos/Plugin/Module.hpp>
  5. #include <iostream>
  6. #include <cstdlib>
  7. //remove outer quotes if they exist
  8. static std::string unquote(const std::string &s)
  9. {
  10. if (s.size() > 2 and s.front() == '"' and s.back() == '"')
  11. {
  12. return s.substr(1, s.length()-2);
  13. }
  14. else return s;
  15. }
  16. void PothosUtilBase::loadModule(const std::string &, const std::string &path)
  17. {
  18. std::cout << "Loading: " << path << std::endl;
  19. //this tests module load and unload -- could throw or cause abort
  20. {
  21. Pothos::PluginModule module(unquote(path));
  22. }
  23. std::cout << "success!" << std::endl;
  24. }