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

Commit ba0fa3f

Browse files
authored
Upgrade dynamic loading API (#120)
* 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]>
1 parent 0bd2170 commit ba0fa3f

File tree

4 files changed

+12
-113
lines changed

4 files changed

+12
-113
lines changed

CMakeLists.txt

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ set(HUNTER_CONFIGURATION_TYPES "Release;Debug" CACHE STRING
1212
include(CMakeDependentOption)
1313
include(HunterGate)
1414
HunterGate(
15-
URL "https://github.com/ruslo/hunter/archive/v0.20.70.tar.gz"
16-
SHA1 "95fb7d11f0828746e2983b5f06ff7981a676da3f"
15+
URL "https://github.com/ruslo/hunter/archive/v0.23.5.tar.gz"
16+
SHA1 "2c5c6fc1cf609d0856695d60f147594daf4e6b3e"
1717
)
1818

1919
project(jaegertracing VERSION 0.5.0)
@@ -255,12 +255,8 @@ if(BUILD_TESTING)
255255
src/jaegertracing/testutils/TracerUtil.cpp)
256256
target_link_libraries(testutils PUBLIC ${JAEGERTRACING_LIB})
257257

258-
if(BUILD_SHARED_LIBS)
259-
set(dynamic_load_test_src src/jaegertracing/DynamicLoadTest.cpp)
260-
endif()
261258
add_executable(UnitTest
262259
src/jaegertracing/ConfigTest.cpp
263-
${dynamic_load_test_src}
264260
src/jaegertracing/ReferenceTest.cpp
265261
src/jaegertracing/SpanContextTest.cpp
266262
src/jaegertracing/SpanTest.cpp
@@ -286,9 +282,6 @@ if(BUILD_TESTING)
286282
src/jaegertracing/utils/ErrorUtilTest.cpp
287283
src/jaegertracing/utils/RateLimiterTest.cpp
288284
src/jaegertracing/utils/UDPClientTest.cpp)
289-
target_compile_definitions(UnitTest PUBLIC
290-
GTEST_HAS_TR1_TUPLE=0
291-
GTEST_USE_OWN_TR1_TUPLE=0)
292285
target_link_libraries(
293286
UnitTest PRIVATE testutils GTest::main)
294287
add_test(NAME UnitTest COMMAND UnitTest)

src/jaegertracing/DynamicLoad.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@
1919

2020
#include <opentracing/dynamic_load.h>
2121

22-
#include "TracerFactory.h"
2322
#include "jaegertracing/Tracer.h"
23+
#include "jaegertracing/TracerFactory.h"
2424

25-
int OpenTracingMakeTracerFactory(const char* opentracingVersion,
26-
const void** errorCategory,
27-
void** tracerFactory)
25+
static int makeTracerFactory(const char* opentracingVersion,
26+
const char* opentracingABIVersion,
27+
const void** errorCategory,
28+
void* errorMessage,
29+
void** tracerFactory)
2830
{
2931
assert(errorCategory != nullptr);
3032
assert(tracerFactory != nullptr);
@@ -33,7 +35,7 @@ int OpenTracingMakeTracerFactory(const char* opentracingVersion,
3335
static_cast<const void*>(&opentracing::dynamic_load_error_category());
3436
return opentracing::dynamic_load_not_supported_error.value();
3537
#endif
36-
if (std::strcmp(opentracingVersion, OPENTRACING_VERSION) != 0) {
38+
if (std::strcmp(opentracingABIVersion, OPENTRACING_ABI_VERSION) != 0) {
3739
*errorCategory = static_cast<const void*>(
3840
&opentracing::dynamic_load_error_category());
3941
return opentracing::incompatible_library_versions_error.value();
@@ -47,3 +49,5 @@ int OpenTracingMakeTracerFactory(const char* opentracingVersion,
4749

4850
return 0;
4951
}
52+
53+
OPENTRACING_DECLARE_IMPL_FACTORY(makeTracerFactory)

src/jaegertracing/DynamicLoadTest.cpp

Lines changed: 0 additions & 99 deletions
This file was deleted.

src/jaegertracing/TracerFactory.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class TracerFactory : public opentracing::TracerFactory {
2727
MakeTracer(const char* configuration, std::string& errorMessage) const
2828
noexcept override;
2929
};
30+
3031
} // namespace jaegertracing
3132

3233
#endif // JAEGERTRACING_TRACER_FACTORY_H

0 commit comments

Comments
 (0)