Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

Commit

Permalink
Upgrade dynamic loading API (#120)
Browse files Browse the repository at this point in the history
* Update Hunter to latest release

Signed-off-by: Isaac Hier <[email protected]>

* Fix library loading with help from mdouaihy

Signed-off-by: Isaac Hier <[email protected]>

* Check ABI version in tracer factory

Signed-off-by: Isaac Hier <[email protected]>

* Fix dynamic loading

Signed-off-by: Isaac Hier <[email protected]>

* Fix dynamic loading

Signed-off-by: Isaac Hier <[email protected]>

* Fix typo in disabled code

Signed-off-by: Isaac Hier <[email protected]>
  • Loading branch information
isaachier authored Aug 6, 2018
1 parent 0bd2170 commit ba0fa3f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 113 deletions.
11 changes: 2 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ set(HUNTER_CONFIGURATION_TYPES "Release;Debug" CACHE STRING
include(CMakeDependentOption)
include(HunterGate)
HunterGate(
URL "https://github.com/ruslo/hunter/archive/v0.20.70.tar.gz"
SHA1 "95fb7d11f0828746e2983b5f06ff7981a676da3f"
URL "https://github.com/ruslo/hunter/archive/v0.23.5.tar.gz"
SHA1 "2c5c6fc1cf609d0856695d60f147594daf4e6b3e"
)

project(jaegertracing VERSION 0.5.0)
Expand Down Expand Up @@ -255,12 +255,8 @@ if(BUILD_TESTING)
src/jaegertracing/testutils/TracerUtil.cpp)
target_link_libraries(testutils PUBLIC ${JAEGERTRACING_LIB})

if(BUILD_SHARED_LIBS)
set(dynamic_load_test_src src/jaegertracing/DynamicLoadTest.cpp)
endif()
add_executable(UnitTest
src/jaegertracing/ConfigTest.cpp
${dynamic_load_test_src}
src/jaegertracing/ReferenceTest.cpp
src/jaegertracing/SpanContextTest.cpp
src/jaegertracing/SpanTest.cpp
Expand All @@ -286,9 +282,6 @@ if(BUILD_TESTING)
src/jaegertracing/utils/ErrorUtilTest.cpp
src/jaegertracing/utils/RateLimiterTest.cpp
src/jaegertracing/utils/UDPClientTest.cpp)
target_compile_definitions(UnitTest PUBLIC
GTEST_HAS_TR1_TUPLE=0
GTEST_USE_OWN_TR1_TUPLE=0)
target_link_libraries(
UnitTest PRIVATE testutils GTest::main)
add_test(NAME UnitTest COMMAND UnitTest)
Expand Down
14 changes: 9 additions & 5 deletions src/jaegertracing/DynamicLoad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@

#include <opentracing/dynamic_load.h>

#include "TracerFactory.h"
#include "jaegertracing/Tracer.h"
#include "jaegertracing/TracerFactory.h"

int OpenTracingMakeTracerFactory(const char* opentracingVersion,
const void** errorCategory,
void** tracerFactory)
static int makeTracerFactory(const char* opentracingVersion,
const char* opentracingABIVersion,
const void** errorCategory,
void* errorMessage,
void** tracerFactory)
{
assert(errorCategory != nullptr);
assert(tracerFactory != nullptr);
Expand All @@ -33,7 +35,7 @@ int OpenTracingMakeTracerFactory(const char* opentracingVersion,
static_cast<const void*>(&opentracing::dynamic_load_error_category());
return opentracing::dynamic_load_not_supported_error.value();
#endif
if (std::strcmp(opentracingVersion, OPENTRACING_VERSION) != 0) {
if (std::strcmp(opentracingABIVersion, OPENTRACING_ABI_VERSION) != 0) {
*errorCategory = static_cast<const void*>(
&opentracing::dynamic_load_error_category());
return opentracing::incompatible_library_versions_error.value();
Expand All @@ -47,3 +49,5 @@ int OpenTracingMakeTracerFactory(const char* opentracingVersion,

return 0;
}

OPENTRACING_DECLARE_IMPL_FACTORY(makeTracerFactory)
99 changes: 0 additions & 99 deletions src/jaegertracing/DynamicLoadTest.cpp

This file was deleted.

1 change: 1 addition & 0 deletions src/jaegertracing/TracerFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class TracerFactory : public opentracing::TracerFactory {
MakeTracer(const char* configuration, std::string& errorMessage) const
noexcept override;
};

} // namespace jaegertracing

#endif // JAEGERTRACING_TRACER_FACTORY_H

0 comments on commit ba0fa3f

Please sign in to comment.