dynamic_load.h 874 B

123456789101112131415161718192021222324252627282930
  1. // Copyright The OpenTelemetry Authors
  2. // SPDX-License-Identifier: Apache-2.0
  3. #pragma once
  4. #include <memory>
  5. #include <string>
  6. #include "opentelemetry/plugin/factory.h"
  7. #include "opentelemetry/version.h"
  8. #ifdef _WIN32
  9. # include "opentelemetry/plugin/detail/dynamic_load_windows.h" // IWYU pragma: export
  10. #else
  11. # include "opentelemetry/plugin/detail/dynamic_load_unix.h" // IWYU pragma: export
  12. #endif
  13. OPENTELEMETRY_BEGIN_NAMESPACE
  14. namespace plugin
  15. {
  16. /**
  17. * Load an OpenTelemetry implementation as a plugin.
  18. * @param plugin the path to the plugin to load
  19. * @param error_message on failure this is set to an error message
  20. * @return a Factory that can be used to create OpenTelemetry objects or nullptr on failure.
  21. */
  22. std::unique_ptr<Factory> LoadFactory(const char *plugin, std::string &error_message) noexcept;
  23. } // namespace plugin
  24. OPENTELEMETRY_END_NAMESPACE