Static.cpp 846 B

123456789101112131415161718192021222324252627
  1. // Copyright (c) 2013-2014 Josh Blum
  2. // SPDX-License-Identifier: BSL-1.0
  3. #include <Pothos/Plugin/Static.hpp>
  4. #include <Pothos/Exception.hpp>
  5. #include <Poco/Logger.h>
  6. void Pothos::Detail::safeInit(const std::string &clientAbi, const std::string &name, InitFcn init)
  7. {
  8. if (clientAbi != Pothos::System::getAbiVersion())
  9. {
  10. poco_error_f3(Poco::Logger::get("Pothos.StaticBlock.safeInit"),
  11. "ABI mismatch when loading %s\n"
  12. "Client expected ABI %s but got %s from the library.",
  13. name, clientAbi, Pothos::System::getAbiVersion());
  14. return;
  15. }
  16. POTHOS_EXCEPTION_TRY
  17. {
  18. init();
  19. }
  20. POTHOS_EXCEPTION_CATCH(const Exception &ex)
  21. {
  22. poco_error_f2(Poco::Logger::get("Pothos.StaticBlock.safeInit"),
  23. "loading %s, exception %s", name, ex.displayText());
  24. }
  25. }