feat(ntp): eternal singleton for NtpTimeService with optional DLL linkage #113
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
ntp_time_service.hppand tests.Description
detail::NtpTimeServiceSingletontemplate and switchedNtpTimeServiceT::instance()to returndetail::NtpTimeServiceSingleton<RunnerT>::instance().TIME_SHIELD_NTP_TIME_SERVICE_USE_DLL_SINGLETON,TIME_SHIELD_NTP_TIME_SERVICE_DLL_EXPORTS, andTIME_SHIELD_NTP_TIME_SERVICE_DLL_IMPLEMENTATIONandTIME_SHIELD_NTP_TIME_SERVICE_APIto control exportedntp_time_service_instance()linkage.ntp_time_service_instance()(whenDLL_IMPLEMENTATIONis defined) and kept the header-only eternal-allocated instance as the default.tests/ntp_time_service_test.cpp, added ODR test sourcestests/odr/ntp_time_service_dll_a.cppandtests/odr/ntp_time_service_dll_b.cpp, and wired them intotests/odr/CMakeLists.txtto validate the DLL-singleton code path.Testing
cmake -S . -B build -DTIME_SHIELD_CPP_BUILD_TESTS=ONand configure succeeded.cmake --build buildand the build completed successfully.ctest --test-dir buildand all tests passed (36/36).ntp_time_service_dll_odrwas built and ran as part of the test suite.Codex Task