From fbe8af2332ee2b78d22cb3e5d81a41374e37340b Mon Sep 17 00:00:00 2001 From: Jay Fitzgerald <34140133+ni-jfitzger@users.noreply.github.com> Date: Sat, 15 Jul 2023 11:10:17 -0500 Subject: [PATCH 1/8] Add setRuntimeEnvironment as a private NI-DCPower function --- generated/nidcpower/nidcpower_library.cpp | 9 +++++ generated/nidcpower/nidcpower_library.h | 3 ++ .../nidcpower/nidcpower_library_interface.h | 1 + generated/nidcpower/nidcpower_mock_library.h | 1 + source/codegen/metadata/nidcpower/__init__.py | 9 ++++- .../metadata/nidcpower/functions_addon.py | 34 +++++++++++++++++++ 6 files changed, 56 insertions(+), 1 deletion(-) diff --git a/generated/nidcpower/nidcpower_library.cpp b/generated/nidcpower/nidcpower_library.cpp index a93521f8e..ee0d0205c 100644 --- a/generated/nidcpower/nidcpower_library.cpp +++ b/generated/nidcpower/nidcpower_library.cpp @@ -169,6 +169,7 @@ NiDCPowerLibrary::NiDCPowerLibrary() : shared_library_(kLibraryName) function_pointers_.UnlockSession = reinterpret_cast(shared_library_.get_function_pointer("niDCPower_UnlockSession")); function_pointers_.WaitForEvent = reinterpret_cast(shared_library_.get_function_pointer("niDCPower_WaitForEvent")); function_pointers_.WaitForEventWithChannels = reinterpret_cast(shared_library_.get_function_pointer("niDCPower_WaitForEventWithChannels")); + function_pointers_.SetRuntimeEnvironment = reinterpret_cast(shared_library_.get_function_pointer("niDCPower_SetRuntimeEnvironment")); } NiDCPowerLibrary::~NiDCPowerLibrary() @@ -1366,4 +1367,12 @@ ViStatus NiDCPowerLibrary::WaitForEventWithChannels(ViSession vi, ViConstString return function_pointers_.WaitForEventWithChannels(vi, channelName, eventId, timeout); } +ViStatus NiDCPowerLibrary::SetRuntimeEnvironment(ViConstString environment, ViConstString environmentVersion, ViConstString reserved1, ViConstString reserved2) +{ + if (!function_pointers_.SetRuntimeEnvironment) { + throw nidevice_grpc::LibraryLoadException("Could not find niDCPower_SetRuntimeEnvironment."); + } + return function_pointers_.SetRuntimeEnvironment(environment, environmentVersion, reserved1, reserved2); +} + } // namespace nidcpower_grpc diff --git a/generated/nidcpower/nidcpower_library.h b/generated/nidcpower/nidcpower_library.h index 6ae9bd49b..95a8c5944 100644 --- a/generated/nidcpower/nidcpower_library.h +++ b/generated/nidcpower/nidcpower_library.h @@ -166,6 +166,7 @@ class NiDCPowerLibrary : public nidcpower_grpc::NiDCPowerLibraryInterface { ViStatus UnlockSession(ViSession vi, ViBoolean* callerHasLock); ViStatus WaitForEvent(ViSession vi, ViInt32 eventId, ViReal64 timeout); ViStatus WaitForEventWithChannels(ViSession vi, ViConstString channelName, ViInt32 eventId, ViReal64 timeout); + ViStatus SetRuntimeEnvironment(ViConstString environment, ViConstString environmentVersion, ViConstString reserved1, ViConstString reserved2); private: using AbortPtr = decltype(&niDCPower_Abort); @@ -316,6 +317,7 @@ class NiDCPowerLibrary : public nidcpower_grpc::NiDCPowerLibraryInterface { using UnlockSessionPtr = ViStatus (*)(ViSession vi, ViBoolean* callerHasLock); using WaitForEventPtr = decltype(&niDCPower_WaitForEvent); using WaitForEventWithChannelsPtr = decltype(&niDCPower_WaitForEventWithChannels); + using SetRuntimeEnvironmentPtr = ViStatus (*)(ViConstString environment, ViConstString environmentVersion, ViConstString reserved1, ViConstString reserved2); typedef struct FunctionPointers { AbortPtr Abort; @@ -466,6 +468,7 @@ class NiDCPowerLibrary : public nidcpower_grpc::NiDCPowerLibraryInterface { UnlockSessionPtr UnlockSession; WaitForEventPtr WaitForEvent; WaitForEventWithChannelsPtr WaitForEventWithChannels; + SetRuntimeEnvironmentPtr SetRuntimeEnvironment; } FunctionLoadStatus; nidevice_grpc::SharedLibrary shared_library_; diff --git a/generated/nidcpower/nidcpower_library_interface.h b/generated/nidcpower/nidcpower_library_interface.h index d082e7815..2be7d920d 100644 --- a/generated/nidcpower/nidcpower_library_interface.h +++ b/generated/nidcpower/nidcpower_library_interface.h @@ -163,6 +163,7 @@ class NiDCPowerLibraryInterface { virtual ViStatus UnlockSession(ViSession vi, ViBoolean* callerHasLock) = 0; virtual ViStatus WaitForEvent(ViSession vi, ViInt32 eventId, ViReal64 timeout) = 0; virtual ViStatus WaitForEventWithChannels(ViSession vi, ViConstString channelName, ViInt32 eventId, ViReal64 timeout) = 0; + virtual ViStatus SetRuntimeEnvironment(ViConstString environment, ViConstString environmentVersion, ViConstString reserved1, ViConstString reserved2) = 0; }; } // namespace nidcpower_grpc diff --git a/generated/nidcpower/nidcpower_mock_library.h b/generated/nidcpower/nidcpower_mock_library.h index c2af1af1f..03bbf4412 100644 --- a/generated/nidcpower/nidcpower_mock_library.h +++ b/generated/nidcpower/nidcpower_mock_library.h @@ -165,6 +165,7 @@ class NiDCPowerMockLibrary : public nidcpower_grpc::NiDCPowerLibraryInterface { MOCK_METHOD(ViStatus, UnlockSession, (ViSession vi, ViBoolean* callerHasLock), (override)); MOCK_METHOD(ViStatus, WaitForEvent, (ViSession vi, ViInt32 eventId, ViReal64 timeout), (override)); MOCK_METHOD(ViStatus, WaitForEventWithChannels, (ViSession vi, ViConstString channelName, ViInt32 eventId, ViReal64 timeout), (override)); + MOCK_METHOD(ViStatus, SetRuntimeEnvironment, (ViConstString environment, ViConstString environmentVersion, ViConstString reserved1, ViConstString reserved2), (override)); }; } // namespace unit diff --git a/source/codegen/metadata/nidcpower/__init__.py b/source/codegen/metadata/nidcpower/__init__.py index 479c7c96a..505b7843d 100644 --- a/source/codegen/metadata/nidcpower/__init__.py +++ b/source/codegen/metadata/nidcpower/__init__.py @@ -1,6 +1,9 @@ from .functions import functions +from .functions_addon import functions_override_metadata from .attributes import attributes +from .attributes_addon import attributes_override_metadata from .enums import enums +from .enums_addon import enums_override_metadata from .config import config metadata = { @@ -8,4 +11,8 @@ "attributes" : attributes, "enums" : enums, "config" : config -} \ No newline at end of file +} + +metadata['functions'].update(functions_override_metadata) +metadata['attributes'].update(attributes_override_metadata) +metadata['enums'].update(enums_override_metadata) \ No newline at end of file diff --git a/source/codegen/metadata/nidcpower/functions_addon.py b/source/codegen/metadata/nidcpower/functions_addon.py index 03bd3b115..4f881393c 100644 --- a/source/codegen/metadata/nidcpower/functions_addon.py +++ b/source/codegen/metadata/nidcpower/functions_addon.py @@ -2,4 +2,38 @@ # Changes to the metadata should be made here, because functions.py is generated thus any changes get overwritten. functions_override_metadata = { + 'SetRuntimeEnvironment': { + 'codegen_method': 'private', + 'parameters': [ + { + 'cppName': 'environment', + 'direction': 'in', + 'grpc_type': 'string', + 'name': 'environment', + 'type': 'ViConstString' + }, + { + 'cppName': 'environmentVersion', + 'direction': 'in', + 'grpc_type': 'string', + 'name': 'environmentVersion', + 'type': 'ViConstString' + }, + { + 'cppName': 'reserved1', + 'direction': 'in', + 'grpc_type': 'string', + 'name': 'reserved1', + 'type': 'ViConstString' + }, + { + 'cppName': 'reserved2', + 'direction': 'in', + 'grpc_type': 'string', + 'name': 'reserved2', + 'type': 'ViConstString' + } + ], + 'returns': 'ViStatus' + }, } \ No newline at end of file From 3d582a34d953e11f643452fd12d3175f2c110ba9 Mon Sep 17 00:00:00 2001 From: Jay Fitzgerald <34140133+ni-jfitzger@users.noreply.github.com> Date: Mon, 17 Jul 2023 17:17:26 -0500 Subject: [PATCH 2/8] Call SetRuntimeEnvironment --- CMakeLists.txt | 11 +++++++++++ generated/nidaqmx/nidaqmx_library.cpp | 1 + generated/nidcpower/nidcpower_library.cpp | 3 +++ .../nidigitalpattern_library.cpp | 1 + generated/nidmm/nidmm_library.cpp | 1 + generated/nifake/nifake_library.cpp | 1 + .../nifake_extension_library.cpp | 1 + .../nifake_non_ivi/nifake_non_ivi_library.cpp | 1 + generated/nifgen/nifgen_library.cpp | 1 + ...mxlcterminaladaptor_restricted_library.cpp | 1 + .../nirfmxbluetooth_library.cpp | 1 + .../nirfmxcdma2k/nirfmxcdma2k_library.cpp | 1 + generated/nirfmxdemod/nirfmxdemod_library.cpp | 1 + generated/nirfmxgsm/nirfmxgsm_library.cpp | 1 + generated/nirfmxinstr/nirfmxinstr_library.cpp | 1 + .../nirfmxinstr_restricted_library.cpp | 1 + generated/nirfmxlte/nirfmxlte_library.cpp | 1 + generated/nirfmxnr/nirfmxnr_library.cpp | 1 + .../nirfmxspecan/nirfmxspecan_library.cpp | 1 + .../nirfmxspecan_restricted_library.cpp | 1 + .../nirfmxtdscdma/nirfmxtdscdma_library.cpp | 1 + generated/nirfmxwcdma/nirfmxwcdma_library.cpp | 1 + generated/nirfmxwlan/nirfmxwlan_library.cpp | 1 + .../nirfmxwlan_restricted_library.cpp | 1 + generated/nirfsa/nirfsa_library.cpp | 1 + generated/nirfsg/nirfsg_library.cpp | 1 + generated/niscope/niscope_library.cpp | 1 + .../niscope_restricted_library.cpp | 1 + generated/niswitch/niswitch_library.cpp | 1 + generated/nisync/nisync_library.cpp | 1 + generated/nitclk/nitclk_library.cpp | 1 + generated/nixnet/nixnet_library.cpp | 1 + .../nixnetsocket/nixnetsocket_library.cpp | 1 + generated/version.h | 19 +++++++++++++++++++ source/codegen/templates/library.cpp.mako | 5 +++++ source/server/version.h.in | 19 +++++++++++++++++++ 36 files changed, 88 insertions(+) create mode 100644 generated/version.h create mode 100644 source/server/version.h.in diff --git a/CMakeLists.txt b/CMakeLists.txt index bf74adebd..ea26928c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -425,6 +425,17 @@ if(WIN32) ) endif() +# Generate version header file +configure_file( + source/server/version.h.in + ${service_output_dir}/version.h + @ONLY) + +target_sources(ni_grpc_device_server + PUBLIC "${service_output_dir}/version.h" +) + + if(CMAKE_SYSTEM_NAME STREQUAL Linux) target_sources(ni_grpc_device_server PRIVATE "source/server/linux/syslog_logging.cpp" diff --git a/generated/nidaqmx/nidaqmx_library.cpp b/generated/nidaqmx/nidaqmx_library.cpp index f043a8bf2..09e0472ee 100644 --- a/generated/nidaqmx/nidaqmx_library.cpp +++ b/generated/nidaqmx/nidaqmx_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-DAQMX Metadata //--------------------------------------------------------------------- #include "nidaqmx_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "nicaiu.dll"; diff --git a/generated/nidcpower/nidcpower_library.cpp b/generated/nidcpower/nidcpower_library.cpp index ee0d0205c..3948dae19 100644 --- a/generated/nidcpower/nidcpower_library.cpp +++ b/generated/nidcpower/nidcpower_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-DCPower Metadata //--------------------------------------------------------------------- #include "nidcpower_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "nidcpower_64.dll"; @@ -170,6 +171,8 @@ NiDCPowerLibrary::NiDCPowerLibrary() : shared_library_(kLibraryName) function_pointers_.WaitForEvent = reinterpret_cast(shared_library_.get_function_pointer("niDCPower_WaitForEvent")); function_pointers_.WaitForEventWithChannels = reinterpret_cast(shared_library_.get_function_pointer("niDCPower_WaitForEventWithChannels")); function_pointers_.SetRuntimeEnvironment = reinterpret_cast(shared_library_.get_function_pointer("niDCPower_SetRuntimeEnvironment")); + + this->SetRuntimeEnvironment(nidevice_grpc::NIDEVICE_GRPC_ORIGINALFILENAME.c_str(), nidevice_grpc::NIDEVICE_GRPC_PRODUCTVERSION.c_str(), "", ""); } NiDCPowerLibrary::~NiDCPowerLibrary() diff --git a/generated/nidigitalpattern/nidigitalpattern_library.cpp b/generated/nidigitalpattern/nidigitalpattern_library.cpp index 8cda12415..65ba40514 100644 --- a/generated/nidigitalpattern/nidigitalpattern_library.cpp +++ b/generated/nidigitalpattern/nidigitalpattern_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-Digital Pattern Driver Metadata //--------------------------------------------------------------------- #include "nidigitalpattern_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niDigital_64.dll"; diff --git a/generated/nidmm/nidmm_library.cpp b/generated/nidmm/nidmm_library.cpp index 2fae8b972..ceb913ece 100644 --- a/generated/nidmm/nidmm_library.cpp +++ b/generated/nidmm/nidmm_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-DMM Metadata //--------------------------------------------------------------------- #include "nidmm_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "nidmm_64.dll"; diff --git a/generated/nifake/nifake_library.cpp b/generated/nifake/nifake_library.cpp index 5241438e0..db7b8a0c5 100644 --- a/generated/nifake/nifake_library.cpp +++ b/generated/nifake/nifake_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-FAKE Metadata //--------------------------------------------------------------------- #include "nifake_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "nifake_64.dll"; diff --git a/generated/nifake_extension/nifake_extension_library.cpp b/generated/nifake_extension/nifake_extension_library.cpp index 35403fa10..29db51b81 100644 --- a/generated/nifake_extension/nifake_extension_library.cpp +++ b/generated/nifake_extension/nifake_extension_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-FAKE-EXTENSION Metadata //--------------------------------------------------------------------- #include "nifake_extension_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "nifake_64.dll"; diff --git a/generated/nifake_non_ivi/nifake_non_ivi_library.cpp b/generated/nifake_non_ivi/nifake_non_ivi_library.cpp index 271a16c70..5c7411dcb 100644 --- a/generated/nifake_non_ivi/nifake_non_ivi_library.cpp +++ b/generated/nifake_non_ivi/nifake_non_ivi_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-FAKE-NON-IVI Metadata //--------------------------------------------------------------------- #include "nifake_non_ivi_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "nifakenonivi_64.dll"; diff --git a/generated/nifgen/nifgen_library.cpp b/generated/nifgen/nifgen_library.cpp index 63f311934..526703c90 100644 --- a/generated/nifgen/nifgen_library.cpp +++ b/generated/nifgen/nifgen_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-FGEN Metadata //--------------------------------------------------------------------- #include "nifgen_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niFgen_64.dll"; diff --git a/generated/nimxlcterminaladaptor_restricted/nimxlcterminaladaptor_restricted_library.cpp b/generated/nimxlcterminaladaptor_restricted/nimxlcterminaladaptor_restricted_library.cpp index 396222b24..92a604c60 100644 --- a/generated/nimxlcterminaladaptor_restricted/nimxlcterminaladaptor_restricted_library.cpp +++ b/generated/nimxlcterminaladaptor_restricted/nimxlcterminaladaptor_restricted_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-MXLCTERMINALADAPTOR-RESTRICTED Metadata //--------------------------------------------------------------------- #include "nimxlcterminaladaptor_restricted_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "nimxlcTerminalAdaptor.dll"; diff --git a/generated/nirfmxbluetooth/nirfmxbluetooth_library.cpp b/generated/nirfmxbluetooth/nirfmxbluetooth_library.cpp index aa01725e8..f82873915 100644 --- a/generated/nirfmxbluetooth/nirfmxbluetooth_library.cpp +++ b/generated/nirfmxbluetooth/nirfmxbluetooth_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-RFMXBLUETOOTH Metadata //--------------------------------------------------------------------- #include "nirfmxbluetooth_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFmxBT.dll"; diff --git a/generated/nirfmxcdma2k/nirfmxcdma2k_library.cpp b/generated/nirfmxcdma2k/nirfmxcdma2k_library.cpp index 24499e8dd..7381cc59f 100644 --- a/generated/nirfmxcdma2k/nirfmxcdma2k_library.cpp +++ b/generated/nirfmxcdma2k/nirfmxcdma2k_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-rfmxcdma2k Metadata //--------------------------------------------------------------------- #include "nirfmxcdma2k_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFmxCDMA2k.dll"; diff --git a/generated/nirfmxdemod/nirfmxdemod_library.cpp b/generated/nirfmxdemod/nirfmxdemod_library.cpp index 6688762c8..d998c7e42 100644 --- a/generated/nirfmxdemod/nirfmxdemod_library.cpp +++ b/generated/nirfmxdemod/nirfmxdemod_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-rfmxdemod Metadata //--------------------------------------------------------------------- #include "nirfmxdemod_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFmxDemod.dll"; diff --git a/generated/nirfmxgsm/nirfmxgsm_library.cpp b/generated/nirfmxgsm/nirfmxgsm_library.cpp index 7a9cdb369..5d5991bde 100644 --- a/generated/nirfmxgsm/nirfmxgsm_library.cpp +++ b/generated/nirfmxgsm/nirfmxgsm_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-RFMXGSM Metadata //--------------------------------------------------------------------- #include "nirfmxgsm_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFmxGSM.dll"; diff --git a/generated/nirfmxinstr/nirfmxinstr_library.cpp b/generated/nirfmxinstr/nirfmxinstr_library.cpp index d86eef39a..502fd57e4 100644 --- a/generated/nirfmxinstr/nirfmxinstr_library.cpp +++ b/generated/nirfmxinstr/nirfmxinstr_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-RFMXINSTR Metadata //--------------------------------------------------------------------- #include "nirfmxinstr_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFmxInstr.dll"; diff --git a/generated/nirfmxinstr_restricted/nirfmxinstr_restricted_library.cpp b/generated/nirfmxinstr_restricted/nirfmxinstr_restricted_library.cpp index b1b54e8fb..d72ecf0c7 100644 --- a/generated/nirfmxinstr_restricted/nirfmxinstr_restricted_library.cpp +++ b/generated/nirfmxinstr_restricted/nirfmxinstr_restricted_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-RFMXINSTR-RESTRICTED Metadata //--------------------------------------------------------------------- #include "nirfmxinstr_restricted_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFmxInstr.dll"; diff --git a/generated/nirfmxlte/nirfmxlte_library.cpp b/generated/nirfmxlte/nirfmxlte_library.cpp index a803bbe0c..62c0ed0fd 100644 --- a/generated/nirfmxlte/nirfmxlte_library.cpp +++ b/generated/nirfmxlte/nirfmxlte_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-RFMXLTE Metadata //--------------------------------------------------------------------- #include "nirfmxlte_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFmxLTE.dll"; diff --git a/generated/nirfmxnr/nirfmxnr_library.cpp b/generated/nirfmxnr/nirfmxnr_library.cpp index e97786850..af92620d0 100644 --- a/generated/nirfmxnr/nirfmxnr_library.cpp +++ b/generated/nirfmxnr/nirfmxnr_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-RFMXNR Metadata //--------------------------------------------------------------------- #include "nirfmxnr_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFmxNR.dll"; diff --git a/generated/nirfmxspecan/nirfmxspecan_library.cpp b/generated/nirfmxspecan/nirfmxspecan_library.cpp index e398ff506..ebf54612c 100644 --- a/generated/nirfmxspecan/nirfmxspecan_library.cpp +++ b/generated/nirfmxspecan/nirfmxspecan_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-RFMXSPECAN Metadata //--------------------------------------------------------------------- #include "nirfmxspecan_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFmxSpecAn.dll"; diff --git a/generated/nirfmxspecan_restricted/nirfmxspecan_restricted_library.cpp b/generated/nirfmxspecan_restricted/nirfmxspecan_restricted_library.cpp index 015fd4409..d2024099b 100644 --- a/generated/nirfmxspecan_restricted/nirfmxspecan_restricted_library.cpp +++ b/generated/nirfmxspecan_restricted/nirfmxspecan_restricted_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-RFMXSPECAN-RESTRICTED Metadata //--------------------------------------------------------------------- #include "nirfmxspecan_restricted_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFmxSpecAn.dll"; diff --git a/generated/nirfmxtdscdma/nirfmxtdscdma_library.cpp b/generated/nirfmxtdscdma/nirfmxtdscdma_library.cpp index eac6c3e4e..2943c2088 100644 --- a/generated/nirfmxtdscdma/nirfmxtdscdma_library.cpp +++ b/generated/nirfmxtdscdma/nirfmxtdscdma_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-rfmxtdscdma Metadata //--------------------------------------------------------------------- #include "nirfmxtdscdma_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFmxTDSCDMA.dll"; diff --git a/generated/nirfmxwcdma/nirfmxwcdma_library.cpp b/generated/nirfmxwcdma/nirfmxwcdma_library.cpp index fa6ddc49b..207bc169f 100644 --- a/generated/nirfmxwcdma/nirfmxwcdma_library.cpp +++ b/generated/nirfmxwcdma/nirfmxwcdma_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-rfmxwcdma Metadata //--------------------------------------------------------------------- #include "nirfmxwcdma_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFmxWCDMA.dll"; diff --git a/generated/nirfmxwlan/nirfmxwlan_library.cpp b/generated/nirfmxwlan/nirfmxwlan_library.cpp index dfd1a533b..74e27911e 100644 --- a/generated/nirfmxwlan/nirfmxwlan_library.cpp +++ b/generated/nirfmxwlan/nirfmxwlan_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-RFMXWLAN Metadata //--------------------------------------------------------------------- #include "nirfmxwlan_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFmxWLAN.dll"; diff --git a/generated/nirfmxwlan_restricted/nirfmxwlan_restricted_library.cpp b/generated/nirfmxwlan_restricted/nirfmxwlan_restricted_library.cpp index f9beb0bdf..c4e31ee64 100644 --- a/generated/nirfmxwlan_restricted/nirfmxwlan_restricted_library.cpp +++ b/generated/nirfmxwlan_restricted/nirfmxwlan_restricted_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-RFMXWLAN-RESTRICTED Metadata //--------------------------------------------------------------------- #include "nirfmxwlan_restricted_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFmxWLAN.dll"; diff --git a/generated/nirfsa/nirfsa_library.cpp b/generated/nirfsa/nirfsa_library.cpp index 65fd96593..33e6729a9 100644 --- a/generated/nirfsa/nirfsa_library.cpp +++ b/generated/nirfsa/nirfsa_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-RFSA Metadata //--------------------------------------------------------------------- #include "nirfsa_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFSA_64.dll"; diff --git a/generated/nirfsg/nirfsg_library.cpp b/generated/nirfsg/nirfsg_library.cpp index 3dc632d79..4275e1414 100644 --- a/generated/nirfsg/nirfsg_library.cpp +++ b/generated/nirfsg/nirfsg_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-RFSG Metadata //--------------------------------------------------------------------- #include "nirfsg_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFSG_64.dll"; diff --git a/generated/niscope/niscope_library.cpp b/generated/niscope/niscope_library.cpp index 75fd31bc9..9c65f90d2 100644 --- a/generated/niscope/niscope_library.cpp +++ b/generated/niscope/niscope_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-SCOPE Metadata //--------------------------------------------------------------------- #include "niscope_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niScope_64.dll"; diff --git a/generated/niscope_restricted/niscope_restricted_library.cpp b/generated/niscope_restricted/niscope_restricted_library.cpp index af3b4612d..1182fd956 100644 --- a/generated/niscope_restricted/niscope_restricted_library.cpp +++ b/generated/niscope_restricted/niscope_restricted_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-SCOPE-RESTRICTED Metadata //--------------------------------------------------------------------- #include "niscope_restricted_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niScope_64.dll"; diff --git a/generated/niswitch/niswitch_library.cpp b/generated/niswitch/niswitch_library.cpp index 1098db302..e0134c1f7 100644 --- a/generated/niswitch/niswitch_library.cpp +++ b/generated/niswitch/niswitch_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-SWITCH Metadata //--------------------------------------------------------------------- #include "niswitch_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niswitch_64.dll"; diff --git a/generated/nisync/nisync_library.cpp b/generated/nisync/nisync_library.cpp index c329084a2..dc4528500 100644 --- a/generated/nisync/nisync_library.cpp +++ b/generated/nisync/nisync_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-SYNC Metadata //--------------------------------------------------------------------- #include "nisync_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "nisync.dll"; diff --git a/generated/nitclk/nitclk_library.cpp b/generated/nitclk/nitclk_library.cpp index 09c178190..410570a62 100644 --- a/generated/nitclk/nitclk_library.cpp +++ b/generated/nitclk/nitclk_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-TClk Metadata //--------------------------------------------------------------------- #include "nitclk_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niTClk_64.dll"; diff --git a/generated/nixnet/nixnet_library.cpp b/generated/nixnet/nixnet_library.cpp index 6b6eb1245..67287ed2a 100644 --- a/generated/nixnet/nixnet_library.cpp +++ b/generated/nixnet/nixnet_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-XNET Metadata //--------------------------------------------------------------------- #include "nixnet_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "nixnet.dll"; diff --git a/generated/nixnetsocket/nixnetsocket_library.cpp b/generated/nixnetsocket/nixnetsocket_library.cpp index dbd76ccad..6b817f0b1 100644 --- a/generated/nixnetsocket/nixnetsocket_library.cpp +++ b/generated/nixnetsocket/nixnetsocket_library.cpp @@ -4,6 +4,7 @@ // Service implementation for the NI-XNETSOCKET Metadata //--------------------------------------------------------------------- #include "nixnetsocket_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "nixntipstack.dll"; diff --git a/generated/version.h b/generated/version.h new file mode 100644 index 000000000..ea5d68910 --- /dev/null +++ b/generated/version.h @@ -0,0 +1,19 @@ +#ifndef NIDEVICE_GRPC_VERSION_H +#define NIDEVICE_GRPC_VERSION_H + +#include + +namespace nidevice_grpc { + +std::string const NIDEVICE_GRPC_MAJORNUMBER = "2"; +std::string const NIDEVICE_GRPC_MINORNUMBER = "3"; +std::string const NIDEVICE_GRPC_BUILDNUMBER = "0"; +std::string const NIDEVICE_GRPC_MODIFICATIONNUMBER = "0"; +std::string const NIDEVICE_GRPC_FILEVERSION = "2.3.0.0"; +std::string const NIDEVICE_GRPC_PRODUCTVERSION = "2.3"; +std::string const NIDEVICE_GRPC_ORIGINALFILENAME = "ni_grpc_device_server.exe"; +std::string const NIDEVICE_GRPC_PRODUCTNAME = "NI gRPC Device Server"; + +} + +#endif // NIDEVICE_GRPC_VERSION_H diff --git a/source/codegen/templates/library.cpp.mako b/source/codegen/templates/library.cpp.mako index 5bae34e65..e0ef94860 100644 --- a/source/codegen/templates/library.cpp.mako +++ b/source/codegen/templates/library.cpp.mako @@ -21,6 +21,7 @@ windows_library_name = windows_library_info['name'] // Service implementation for the ${config["driver_name"]} Metadata //--------------------------------------------------------------------- #include "${module_name}_library.h" +#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "${windows_library_name}"; @@ -44,6 +45,10 @@ ${service_class_prefix}Library::${service_class_prefix}Library() : shared_librar %>\ function_pointers_.${method_name} = reinterpret_cast<${method_name}Ptr>(shared_library_.get_function_pointer("${c_name}")); % endfor +% if 'SetRuntimeEnvironment' in service_helpers.filter_api_functions(functions, only_mockable_functions=False): + + this->SetRuntimeEnvironment(nidevice_grpc::NIDEVICE_GRPC_ORIGINALFILENAME.c_str(), nidevice_grpc::NIDEVICE_GRPC_PRODUCTVERSION.c_str(), "", ""); +% endif } ${service_class_prefix}Library::~${service_class_prefix}Library() diff --git a/source/server/version.h.in b/source/server/version.h.in new file mode 100644 index 000000000..0fafe5642 --- /dev/null +++ b/source/server/version.h.in @@ -0,0 +1,19 @@ +#ifndef NIDEVICE_GRPC_VERSION_H +#define NIDEVICE_GRPC_VERSION_H + +#include + +namespace nidevice_grpc { + +std::string const NIDEVICE_GRPC_MAJORNUMBER = "@PROJECT_VERSION_MAJOR@"; +std::string const NIDEVICE_GRPC_MINORNUMBER = "@PROJECT_VERSION_MINOR@"; +std::string const NIDEVICE_GRPC_BUILDNUMBER = "@PROJECT_VERSION_PATCH@"; +std::string const NIDEVICE_GRPC_MODIFICATIONNUMBER = "0"; +std::string const NIDEVICE_GRPC_FILEVERSION = "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.0"; +std::string const NIDEVICE_GRPC_PRODUCTVERSION = "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@"; +std::string const NIDEVICE_GRPC_ORIGINALFILENAME = "ni_grpc_device_server.exe"; +std::string const NIDEVICE_GRPC_PRODUCTNAME = "NI gRPC Device Server"; + +} + +#endif // NIDEVICE_GRPC_VERSION_H \ No newline at end of file From 3bdebe4e0ff9ebd211aefaf169ac7fe782ba36f7 Mon Sep 17 00:00:00 2001 From: Jay Fitzgerald <34140133+ni-jfitzger@users.noreply.github.com> Date: Mon, 17 Jul 2023 17:19:45 -0500 Subject: [PATCH 3/8] Use FILEVERSION, instead --- generated/nidcpower/nidcpower_library.cpp | 2 +- source/codegen/templates/library.cpp.mako | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/generated/nidcpower/nidcpower_library.cpp b/generated/nidcpower/nidcpower_library.cpp index 3948dae19..58aa478f8 100644 --- a/generated/nidcpower/nidcpower_library.cpp +++ b/generated/nidcpower/nidcpower_library.cpp @@ -172,7 +172,7 @@ NiDCPowerLibrary::NiDCPowerLibrary() : shared_library_(kLibraryName) function_pointers_.WaitForEventWithChannels = reinterpret_cast(shared_library_.get_function_pointer("niDCPower_WaitForEventWithChannels")); function_pointers_.SetRuntimeEnvironment = reinterpret_cast(shared_library_.get_function_pointer("niDCPower_SetRuntimeEnvironment")); - this->SetRuntimeEnvironment(nidevice_grpc::NIDEVICE_GRPC_ORIGINALFILENAME.c_str(), nidevice_grpc::NIDEVICE_GRPC_PRODUCTVERSION.c_str(), "", ""); + this->SetRuntimeEnvironment(nidevice_grpc::NIDEVICE_GRPC_ORIGINALFILENAME.c_str(), nidevice_grpc::NIDEVICE_GRPC_FILEVERSION.c_str(), "", ""); } NiDCPowerLibrary::~NiDCPowerLibrary() diff --git a/source/codegen/templates/library.cpp.mako b/source/codegen/templates/library.cpp.mako index e0ef94860..230c8efbf 100644 --- a/source/codegen/templates/library.cpp.mako +++ b/source/codegen/templates/library.cpp.mako @@ -47,7 +47,7 @@ ${service_class_prefix}Library::${service_class_prefix}Library() : shared_librar % endfor % if 'SetRuntimeEnvironment' in service_helpers.filter_api_functions(functions, only_mockable_functions=False): - this->SetRuntimeEnvironment(nidevice_grpc::NIDEVICE_GRPC_ORIGINALFILENAME.c_str(), nidevice_grpc::NIDEVICE_GRPC_PRODUCTVERSION.c_str(), "", ""); + this->SetRuntimeEnvironment(nidevice_grpc::NIDEVICE_GRPC_ORIGINALFILENAME.c_str(), nidevice_grpc::NIDEVICE_GRPC_FILEVERSION.c_str(), "", ""); % endif } From 61877369be61d5c406613212a9cbc49939e33a0d Mon Sep 17 00:00:00 2001 From: Jay Fitzgerald <34140133+ni-jfitzger@users.noreply.github.com> Date: Tue, 18 Jul 2023 12:20:03 -0500 Subject: [PATCH 4/8] Address Feedback: * Use constexpr to avoid codebloat * Follow naming conventions * Eliminate unused constants * Add comment to CMakeLists.txt --- CMakeLists.txt | 1 + generated/nidcpower/nidcpower_library.cpp | 2 +- generated/version.h | 12 ++---------- source/codegen/templates/library.cpp.mako | 2 +- source/server/version.h.in | 12 ++---------- 5 files changed, 7 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ea26928c3..26fe927dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -426,6 +426,7 @@ if(WIN32) endif() # Generate version header file +# This file requires product name and version info that mako does not know, but CMake does configure_file( source/server/version.h.in ${service_output_dir}/version.h diff --git a/generated/nidcpower/nidcpower_library.cpp b/generated/nidcpower/nidcpower_library.cpp index 58aa478f8..935259a94 100644 --- a/generated/nidcpower/nidcpower_library.cpp +++ b/generated/nidcpower/nidcpower_library.cpp @@ -172,7 +172,7 @@ NiDCPowerLibrary::NiDCPowerLibrary() : shared_library_(kLibraryName) function_pointers_.WaitForEventWithChannels = reinterpret_cast(shared_library_.get_function_pointer("niDCPower_WaitForEventWithChannels")); function_pointers_.SetRuntimeEnvironment = reinterpret_cast(shared_library_.get_function_pointer("niDCPower_SetRuntimeEnvironment")); - this->SetRuntimeEnvironment(nidevice_grpc::NIDEVICE_GRPC_ORIGINALFILENAME.c_str(), nidevice_grpc::NIDEVICE_GRPC_FILEVERSION.c_str(), "", ""); + this->SetRuntimeEnvironment(nidevice_grpc::kNiDeviceGrpcFileVersion, nidevice_grpc::kNiDeviceGrpcOriginalFileName, "", ""); } NiDCPowerLibrary::~NiDCPowerLibrary() diff --git a/generated/version.h b/generated/version.h index ea5d68910..0fa6a784f 100644 --- a/generated/version.h +++ b/generated/version.h @@ -1,18 +1,10 @@ #ifndef NIDEVICE_GRPC_VERSION_H #define NIDEVICE_GRPC_VERSION_H -#include - namespace nidevice_grpc { -std::string const NIDEVICE_GRPC_MAJORNUMBER = "2"; -std::string const NIDEVICE_GRPC_MINORNUMBER = "3"; -std::string const NIDEVICE_GRPC_BUILDNUMBER = "0"; -std::string const NIDEVICE_GRPC_MODIFICATIONNUMBER = "0"; -std::string const NIDEVICE_GRPC_FILEVERSION = "2.3.0.0"; -std::string const NIDEVICE_GRPC_PRODUCTVERSION = "2.3"; -std::string const NIDEVICE_GRPC_ORIGINALFILENAME = "ni_grpc_device_server.exe"; -std::string const NIDEVICE_GRPC_PRODUCTNAME = "NI gRPC Device Server"; +constexpr const char* kNiDeviceGrpcFileVersion = "2.3.0.0"; +constexpr const char* kNiDeviceGrpcOriginalFileName = "ni_grpc_device_server.exe"; } diff --git a/source/codegen/templates/library.cpp.mako b/source/codegen/templates/library.cpp.mako index 230c8efbf..cd4d1c5fb 100644 --- a/source/codegen/templates/library.cpp.mako +++ b/source/codegen/templates/library.cpp.mako @@ -47,7 +47,7 @@ ${service_class_prefix}Library::${service_class_prefix}Library() : shared_librar % endfor % if 'SetRuntimeEnvironment' in service_helpers.filter_api_functions(functions, only_mockable_functions=False): - this->SetRuntimeEnvironment(nidevice_grpc::NIDEVICE_GRPC_ORIGINALFILENAME.c_str(), nidevice_grpc::NIDEVICE_GRPC_FILEVERSION.c_str(), "", ""); + this->SetRuntimeEnvironment(nidevice_grpc::kNiDeviceGrpcFileVersion, nidevice_grpc::kNiDeviceGrpcOriginalFileName, "", ""); % endif } diff --git a/source/server/version.h.in b/source/server/version.h.in index 0fafe5642..9c98cd09a 100644 --- a/source/server/version.h.in +++ b/source/server/version.h.in @@ -1,18 +1,10 @@ #ifndef NIDEVICE_GRPC_VERSION_H #define NIDEVICE_GRPC_VERSION_H -#include - namespace nidevice_grpc { -std::string const NIDEVICE_GRPC_MAJORNUMBER = "@PROJECT_VERSION_MAJOR@"; -std::string const NIDEVICE_GRPC_MINORNUMBER = "@PROJECT_VERSION_MINOR@"; -std::string const NIDEVICE_GRPC_BUILDNUMBER = "@PROJECT_VERSION_PATCH@"; -std::string const NIDEVICE_GRPC_MODIFICATIONNUMBER = "0"; -std::string const NIDEVICE_GRPC_FILEVERSION = "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.0"; -std::string const NIDEVICE_GRPC_PRODUCTVERSION = "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@"; -std::string const NIDEVICE_GRPC_ORIGINALFILENAME = "ni_grpc_device_server.exe"; -std::string const NIDEVICE_GRPC_PRODUCTNAME = "NI gRPC Device Server"; +constexpr const char* kNiDeviceGrpcFileVersion = "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.0"; +constexpr const char* kNiDeviceGrpcOriginalFileName = "ni_grpc_device_server.exe"; } From 2e7c120c37116be45e4cdc34ae591feac2412d9c Mon Sep 17 00:00:00 2001 From: Jay Fitzgerald <34140133+ni-jfitzger@users.noreply.github.com> Date: Tue, 18 Jul 2023 12:30:42 -0500 Subject: [PATCH 5/8] Conditionally call SetRuntimeEnvironment --- generated/nidcpower/nidcpower_library.cpp | 4 +++- source/codegen/templates/library.cpp.mako | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/generated/nidcpower/nidcpower_library.cpp b/generated/nidcpower/nidcpower_library.cpp index 935259a94..fe5cb9766 100644 --- a/generated/nidcpower/nidcpower_library.cpp +++ b/generated/nidcpower/nidcpower_library.cpp @@ -172,7 +172,9 @@ NiDCPowerLibrary::NiDCPowerLibrary() : shared_library_(kLibraryName) function_pointers_.WaitForEventWithChannels = reinterpret_cast(shared_library_.get_function_pointer("niDCPower_WaitForEventWithChannels")); function_pointers_.SetRuntimeEnvironment = reinterpret_cast(shared_library_.get_function_pointer("niDCPower_SetRuntimeEnvironment")); - this->SetRuntimeEnvironment(nidevice_grpc::kNiDeviceGrpcFileVersion, nidevice_grpc::kNiDeviceGrpcOriginalFileName, "", ""); + if (function_pointers_.SetRuntimeEnvironment) { + this->SetRuntimeEnvironment(nidevice_grpc::kNiDeviceGrpcFileVersion, nidevice_grpc::kNiDeviceGrpcOriginalFileName, "", ""); + } } NiDCPowerLibrary::~NiDCPowerLibrary() diff --git a/source/codegen/templates/library.cpp.mako b/source/codegen/templates/library.cpp.mako index cd4d1c5fb..da1bb1651 100644 --- a/source/codegen/templates/library.cpp.mako +++ b/source/codegen/templates/library.cpp.mako @@ -47,7 +47,9 @@ ${service_class_prefix}Library::${service_class_prefix}Library() : shared_librar % endfor % if 'SetRuntimeEnvironment' in service_helpers.filter_api_functions(functions, only_mockable_functions=False): - this->SetRuntimeEnvironment(nidevice_grpc::kNiDeviceGrpcFileVersion, nidevice_grpc::kNiDeviceGrpcOriginalFileName, "", ""); + if (function_pointers_.SetRuntimeEnvironment) { + this->SetRuntimeEnvironment(nidevice_grpc::kNiDeviceGrpcFileVersion, nidevice_grpc::kNiDeviceGrpcOriginalFileName, "", ""); + } % endif } From e56b3a26b181c3032c80a3d1d3434a87a33ea471 Mon Sep 17 00:00:00 2001 From: Jay Fitzgerald <34140133+ni-jfitzger@users.noreply.github.com> Date: Tue, 18 Jul 2023 16:59:08 -0500 Subject: [PATCH 6/8] Make constants static, just in case --- generated/version.h | 4 ++-- source/server/version.h.in | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/generated/version.h b/generated/version.h index 0fa6a784f..9da828da7 100644 --- a/generated/version.h +++ b/generated/version.h @@ -3,8 +3,8 @@ namespace nidevice_grpc { -constexpr const char* kNiDeviceGrpcFileVersion = "2.3.0.0"; -constexpr const char* kNiDeviceGrpcOriginalFileName = "ni_grpc_device_server.exe"; +static constexpr const char* kNiDeviceGrpcFileVersion = "2.3.0.0"; +static constexpr const char* kNiDeviceGrpcOriginalFileName = "ni_grpc_device_server.exe"; } diff --git a/source/server/version.h.in b/source/server/version.h.in index 9c98cd09a..c2c3ab499 100644 --- a/source/server/version.h.in +++ b/source/server/version.h.in @@ -3,8 +3,8 @@ namespace nidevice_grpc { -constexpr const char* kNiDeviceGrpcFileVersion = "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.0"; -constexpr const char* kNiDeviceGrpcOriginalFileName = "ni_grpc_device_server.exe"; +static constexpr const char* kNiDeviceGrpcFileVersion = "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.0"; +static constexpr const char* kNiDeviceGrpcOriginalFileName = "ni_grpc_device_server.exe"; } From 6eb11206968166e5fb845cb129270b72cbaa3b34 Mon Sep 17 00:00:00 2001 From: Jay Fitzgerald <34140133+ni-jfitzger@users.noreply.github.com> Date: Tue, 18 Jul 2023 17:03:59 -0500 Subject: [PATCH 7/8] Conditionally include version.h --- generated/nidaqmx/nidaqmx_library.cpp | 1 - generated/nidigitalpattern/nidigitalpattern_library.cpp | 1 - generated/nidmm/nidmm_library.cpp | 1 - generated/nifake/nifake_library.cpp | 1 - generated/nifake_extension/nifake_extension_library.cpp | 1 - generated/nifake_non_ivi/nifake_non_ivi_library.cpp | 1 - generated/nifgen/nifgen_library.cpp | 1 - .../nimxlcterminaladaptor_restricted_library.cpp | 1 - generated/nirfmxbluetooth/nirfmxbluetooth_library.cpp | 1 - generated/nirfmxcdma2k/nirfmxcdma2k_library.cpp | 1 - generated/nirfmxdemod/nirfmxdemod_library.cpp | 1 - generated/nirfmxgsm/nirfmxgsm_library.cpp | 1 - generated/nirfmxinstr/nirfmxinstr_library.cpp | 1 - .../nirfmxinstr_restricted/nirfmxinstr_restricted_library.cpp | 1 - generated/nirfmxlte/nirfmxlte_library.cpp | 1 - generated/nirfmxnr/nirfmxnr_library.cpp | 1 - generated/nirfmxspecan/nirfmxspecan_library.cpp | 1 - .../nirfmxspecan_restricted/nirfmxspecan_restricted_library.cpp | 1 - generated/nirfmxtdscdma/nirfmxtdscdma_library.cpp | 1 - generated/nirfmxwcdma/nirfmxwcdma_library.cpp | 1 - generated/nirfmxwlan/nirfmxwlan_library.cpp | 1 - .../nirfmxwlan_restricted/nirfmxwlan_restricted_library.cpp | 1 - generated/nirfsa/nirfsa_library.cpp | 1 - generated/nirfsg/nirfsg_library.cpp | 1 - generated/niscope/niscope_library.cpp | 1 - generated/niscope_restricted/niscope_restricted_library.cpp | 1 - generated/niswitch/niswitch_library.cpp | 1 - generated/nisync/nisync_library.cpp | 1 - generated/nitclk/nitclk_library.cpp | 1 - generated/nixnet/nixnet_library.cpp | 1 - generated/nixnetsocket/nixnetsocket_library.cpp | 1 - source/codegen/templates/library.cpp.mako | 2 ++ 32 files changed, 2 insertions(+), 31 deletions(-) diff --git a/generated/nidaqmx/nidaqmx_library.cpp b/generated/nidaqmx/nidaqmx_library.cpp index 09e0472ee..f043a8bf2 100644 --- a/generated/nidaqmx/nidaqmx_library.cpp +++ b/generated/nidaqmx/nidaqmx_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-DAQMX Metadata //--------------------------------------------------------------------- #include "nidaqmx_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "nicaiu.dll"; diff --git a/generated/nidigitalpattern/nidigitalpattern_library.cpp b/generated/nidigitalpattern/nidigitalpattern_library.cpp index 65ba40514..8cda12415 100644 --- a/generated/nidigitalpattern/nidigitalpattern_library.cpp +++ b/generated/nidigitalpattern/nidigitalpattern_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-Digital Pattern Driver Metadata //--------------------------------------------------------------------- #include "nidigitalpattern_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niDigital_64.dll"; diff --git a/generated/nidmm/nidmm_library.cpp b/generated/nidmm/nidmm_library.cpp index ceb913ece..2fae8b972 100644 --- a/generated/nidmm/nidmm_library.cpp +++ b/generated/nidmm/nidmm_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-DMM Metadata //--------------------------------------------------------------------- #include "nidmm_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "nidmm_64.dll"; diff --git a/generated/nifake/nifake_library.cpp b/generated/nifake/nifake_library.cpp index db7b8a0c5..5241438e0 100644 --- a/generated/nifake/nifake_library.cpp +++ b/generated/nifake/nifake_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-FAKE Metadata //--------------------------------------------------------------------- #include "nifake_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "nifake_64.dll"; diff --git a/generated/nifake_extension/nifake_extension_library.cpp b/generated/nifake_extension/nifake_extension_library.cpp index 29db51b81..35403fa10 100644 --- a/generated/nifake_extension/nifake_extension_library.cpp +++ b/generated/nifake_extension/nifake_extension_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-FAKE-EXTENSION Metadata //--------------------------------------------------------------------- #include "nifake_extension_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "nifake_64.dll"; diff --git a/generated/nifake_non_ivi/nifake_non_ivi_library.cpp b/generated/nifake_non_ivi/nifake_non_ivi_library.cpp index 5c7411dcb..271a16c70 100644 --- a/generated/nifake_non_ivi/nifake_non_ivi_library.cpp +++ b/generated/nifake_non_ivi/nifake_non_ivi_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-FAKE-NON-IVI Metadata //--------------------------------------------------------------------- #include "nifake_non_ivi_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "nifakenonivi_64.dll"; diff --git a/generated/nifgen/nifgen_library.cpp b/generated/nifgen/nifgen_library.cpp index 526703c90..63f311934 100644 --- a/generated/nifgen/nifgen_library.cpp +++ b/generated/nifgen/nifgen_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-FGEN Metadata //--------------------------------------------------------------------- #include "nifgen_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niFgen_64.dll"; diff --git a/generated/nimxlcterminaladaptor_restricted/nimxlcterminaladaptor_restricted_library.cpp b/generated/nimxlcterminaladaptor_restricted/nimxlcterminaladaptor_restricted_library.cpp index 92a604c60..396222b24 100644 --- a/generated/nimxlcterminaladaptor_restricted/nimxlcterminaladaptor_restricted_library.cpp +++ b/generated/nimxlcterminaladaptor_restricted/nimxlcterminaladaptor_restricted_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-MXLCTERMINALADAPTOR-RESTRICTED Metadata //--------------------------------------------------------------------- #include "nimxlcterminaladaptor_restricted_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "nimxlcTerminalAdaptor.dll"; diff --git a/generated/nirfmxbluetooth/nirfmxbluetooth_library.cpp b/generated/nirfmxbluetooth/nirfmxbluetooth_library.cpp index f82873915..aa01725e8 100644 --- a/generated/nirfmxbluetooth/nirfmxbluetooth_library.cpp +++ b/generated/nirfmxbluetooth/nirfmxbluetooth_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-RFMXBLUETOOTH Metadata //--------------------------------------------------------------------- #include "nirfmxbluetooth_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFmxBT.dll"; diff --git a/generated/nirfmxcdma2k/nirfmxcdma2k_library.cpp b/generated/nirfmxcdma2k/nirfmxcdma2k_library.cpp index 7381cc59f..24499e8dd 100644 --- a/generated/nirfmxcdma2k/nirfmxcdma2k_library.cpp +++ b/generated/nirfmxcdma2k/nirfmxcdma2k_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-rfmxcdma2k Metadata //--------------------------------------------------------------------- #include "nirfmxcdma2k_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFmxCDMA2k.dll"; diff --git a/generated/nirfmxdemod/nirfmxdemod_library.cpp b/generated/nirfmxdemod/nirfmxdemod_library.cpp index d998c7e42..6688762c8 100644 --- a/generated/nirfmxdemod/nirfmxdemod_library.cpp +++ b/generated/nirfmxdemod/nirfmxdemod_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-rfmxdemod Metadata //--------------------------------------------------------------------- #include "nirfmxdemod_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFmxDemod.dll"; diff --git a/generated/nirfmxgsm/nirfmxgsm_library.cpp b/generated/nirfmxgsm/nirfmxgsm_library.cpp index 5d5991bde..7a9cdb369 100644 --- a/generated/nirfmxgsm/nirfmxgsm_library.cpp +++ b/generated/nirfmxgsm/nirfmxgsm_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-RFMXGSM Metadata //--------------------------------------------------------------------- #include "nirfmxgsm_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFmxGSM.dll"; diff --git a/generated/nirfmxinstr/nirfmxinstr_library.cpp b/generated/nirfmxinstr/nirfmxinstr_library.cpp index 502fd57e4..d86eef39a 100644 --- a/generated/nirfmxinstr/nirfmxinstr_library.cpp +++ b/generated/nirfmxinstr/nirfmxinstr_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-RFMXINSTR Metadata //--------------------------------------------------------------------- #include "nirfmxinstr_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFmxInstr.dll"; diff --git a/generated/nirfmxinstr_restricted/nirfmxinstr_restricted_library.cpp b/generated/nirfmxinstr_restricted/nirfmxinstr_restricted_library.cpp index d72ecf0c7..b1b54e8fb 100644 --- a/generated/nirfmxinstr_restricted/nirfmxinstr_restricted_library.cpp +++ b/generated/nirfmxinstr_restricted/nirfmxinstr_restricted_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-RFMXINSTR-RESTRICTED Metadata //--------------------------------------------------------------------- #include "nirfmxinstr_restricted_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFmxInstr.dll"; diff --git a/generated/nirfmxlte/nirfmxlte_library.cpp b/generated/nirfmxlte/nirfmxlte_library.cpp index 62c0ed0fd..a803bbe0c 100644 --- a/generated/nirfmxlte/nirfmxlte_library.cpp +++ b/generated/nirfmxlte/nirfmxlte_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-RFMXLTE Metadata //--------------------------------------------------------------------- #include "nirfmxlte_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFmxLTE.dll"; diff --git a/generated/nirfmxnr/nirfmxnr_library.cpp b/generated/nirfmxnr/nirfmxnr_library.cpp index af92620d0..e97786850 100644 --- a/generated/nirfmxnr/nirfmxnr_library.cpp +++ b/generated/nirfmxnr/nirfmxnr_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-RFMXNR Metadata //--------------------------------------------------------------------- #include "nirfmxnr_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFmxNR.dll"; diff --git a/generated/nirfmxspecan/nirfmxspecan_library.cpp b/generated/nirfmxspecan/nirfmxspecan_library.cpp index ebf54612c..e398ff506 100644 --- a/generated/nirfmxspecan/nirfmxspecan_library.cpp +++ b/generated/nirfmxspecan/nirfmxspecan_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-RFMXSPECAN Metadata //--------------------------------------------------------------------- #include "nirfmxspecan_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFmxSpecAn.dll"; diff --git a/generated/nirfmxspecan_restricted/nirfmxspecan_restricted_library.cpp b/generated/nirfmxspecan_restricted/nirfmxspecan_restricted_library.cpp index d2024099b..015fd4409 100644 --- a/generated/nirfmxspecan_restricted/nirfmxspecan_restricted_library.cpp +++ b/generated/nirfmxspecan_restricted/nirfmxspecan_restricted_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-RFMXSPECAN-RESTRICTED Metadata //--------------------------------------------------------------------- #include "nirfmxspecan_restricted_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFmxSpecAn.dll"; diff --git a/generated/nirfmxtdscdma/nirfmxtdscdma_library.cpp b/generated/nirfmxtdscdma/nirfmxtdscdma_library.cpp index 2943c2088..eac6c3e4e 100644 --- a/generated/nirfmxtdscdma/nirfmxtdscdma_library.cpp +++ b/generated/nirfmxtdscdma/nirfmxtdscdma_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-rfmxtdscdma Metadata //--------------------------------------------------------------------- #include "nirfmxtdscdma_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFmxTDSCDMA.dll"; diff --git a/generated/nirfmxwcdma/nirfmxwcdma_library.cpp b/generated/nirfmxwcdma/nirfmxwcdma_library.cpp index 207bc169f..fa6ddc49b 100644 --- a/generated/nirfmxwcdma/nirfmxwcdma_library.cpp +++ b/generated/nirfmxwcdma/nirfmxwcdma_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-rfmxwcdma Metadata //--------------------------------------------------------------------- #include "nirfmxwcdma_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFmxWCDMA.dll"; diff --git a/generated/nirfmxwlan/nirfmxwlan_library.cpp b/generated/nirfmxwlan/nirfmxwlan_library.cpp index 74e27911e..dfd1a533b 100644 --- a/generated/nirfmxwlan/nirfmxwlan_library.cpp +++ b/generated/nirfmxwlan/nirfmxwlan_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-RFMXWLAN Metadata //--------------------------------------------------------------------- #include "nirfmxwlan_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFmxWLAN.dll"; diff --git a/generated/nirfmxwlan_restricted/nirfmxwlan_restricted_library.cpp b/generated/nirfmxwlan_restricted/nirfmxwlan_restricted_library.cpp index c4e31ee64..f9beb0bdf 100644 --- a/generated/nirfmxwlan_restricted/nirfmxwlan_restricted_library.cpp +++ b/generated/nirfmxwlan_restricted/nirfmxwlan_restricted_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-RFMXWLAN-RESTRICTED Metadata //--------------------------------------------------------------------- #include "nirfmxwlan_restricted_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFmxWLAN.dll"; diff --git a/generated/nirfsa/nirfsa_library.cpp b/generated/nirfsa/nirfsa_library.cpp index 33e6729a9..65fd96593 100644 --- a/generated/nirfsa/nirfsa_library.cpp +++ b/generated/nirfsa/nirfsa_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-RFSA Metadata //--------------------------------------------------------------------- #include "nirfsa_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFSA_64.dll"; diff --git a/generated/nirfsg/nirfsg_library.cpp b/generated/nirfsg/nirfsg_library.cpp index 4275e1414..3dc632d79 100644 --- a/generated/nirfsg/nirfsg_library.cpp +++ b/generated/nirfsg/nirfsg_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-RFSG Metadata //--------------------------------------------------------------------- #include "nirfsg_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niRFSG_64.dll"; diff --git a/generated/niscope/niscope_library.cpp b/generated/niscope/niscope_library.cpp index 9c65f90d2..75fd31bc9 100644 --- a/generated/niscope/niscope_library.cpp +++ b/generated/niscope/niscope_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-SCOPE Metadata //--------------------------------------------------------------------- #include "niscope_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niScope_64.dll"; diff --git a/generated/niscope_restricted/niscope_restricted_library.cpp b/generated/niscope_restricted/niscope_restricted_library.cpp index 1182fd956..af3b4612d 100644 --- a/generated/niscope_restricted/niscope_restricted_library.cpp +++ b/generated/niscope_restricted/niscope_restricted_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-SCOPE-RESTRICTED Metadata //--------------------------------------------------------------------- #include "niscope_restricted_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niScope_64.dll"; diff --git a/generated/niswitch/niswitch_library.cpp b/generated/niswitch/niswitch_library.cpp index e0134c1f7..1098db302 100644 --- a/generated/niswitch/niswitch_library.cpp +++ b/generated/niswitch/niswitch_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-SWITCH Metadata //--------------------------------------------------------------------- #include "niswitch_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niswitch_64.dll"; diff --git a/generated/nisync/nisync_library.cpp b/generated/nisync/nisync_library.cpp index dc4528500..c329084a2 100644 --- a/generated/nisync/nisync_library.cpp +++ b/generated/nisync/nisync_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-SYNC Metadata //--------------------------------------------------------------------- #include "nisync_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "nisync.dll"; diff --git a/generated/nitclk/nitclk_library.cpp b/generated/nitclk/nitclk_library.cpp index 410570a62..09c178190 100644 --- a/generated/nitclk/nitclk_library.cpp +++ b/generated/nitclk/nitclk_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-TClk Metadata //--------------------------------------------------------------------- #include "nitclk_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "niTClk_64.dll"; diff --git a/generated/nixnet/nixnet_library.cpp b/generated/nixnet/nixnet_library.cpp index 67287ed2a..6b6eb1245 100644 --- a/generated/nixnet/nixnet_library.cpp +++ b/generated/nixnet/nixnet_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-XNET Metadata //--------------------------------------------------------------------- #include "nixnet_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "nixnet.dll"; diff --git a/generated/nixnetsocket/nixnetsocket_library.cpp b/generated/nixnetsocket/nixnetsocket_library.cpp index 6b817f0b1..dbd76ccad 100644 --- a/generated/nixnetsocket/nixnetsocket_library.cpp +++ b/generated/nixnetsocket/nixnetsocket_library.cpp @@ -4,7 +4,6 @@ // Service implementation for the NI-XNETSOCKET Metadata //--------------------------------------------------------------------- #include "nixnetsocket_library.h" -#include "version.h" #if defined(_MSC_VER) static const char* kLibraryName = "nixntipstack.dll"; diff --git a/source/codegen/templates/library.cpp.mako b/source/codegen/templates/library.cpp.mako index da1bb1651..6c388cb08 100644 --- a/source/codegen/templates/library.cpp.mako +++ b/source/codegen/templates/library.cpp.mako @@ -21,7 +21,9 @@ windows_library_name = windows_library_info['name'] // Service implementation for the ${config["driver_name"]} Metadata //--------------------------------------------------------------------- #include "${module_name}_library.h" +% if 'SetRuntimeEnvironment' in service_helpers.filter_api_functions(functions, only_mockable_functions=False): #include "version.h" +% endif #if defined(_MSC_VER) static const char* kLibraryName = "${windows_library_name}"; From 310ac3f15c4afcb41ddbc2646c18a74208c9e5dc Mon Sep 17 00:00:00 2001 From: Jay Fitzgerald <34140133+ni-jfitzger@users.noreply.github.com> Date: Wed, 19 Jul 2023 08:26:05 -0500 Subject: [PATCH 8/8] Fix argument order --- generated/nidcpower/nidcpower_library.cpp | 2 +- source/codegen/templates/library.cpp.mako | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/generated/nidcpower/nidcpower_library.cpp b/generated/nidcpower/nidcpower_library.cpp index fe5cb9766..8313705f6 100644 --- a/generated/nidcpower/nidcpower_library.cpp +++ b/generated/nidcpower/nidcpower_library.cpp @@ -173,7 +173,7 @@ NiDCPowerLibrary::NiDCPowerLibrary() : shared_library_(kLibraryName) function_pointers_.SetRuntimeEnvironment = reinterpret_cast(shared_library_.get_function_pointer("niDCPower_SetRuntimeEnvironment")); if (function_pointers_.SetRuntimeEnvironment) { - this->SetRuntimeEnvironment(nidevice_grpc::kNiDeviceGrpcFileVersion, nidevice_grpc::kNiDeviceGrpcOriginalFileName, "", ""); + this->SetRuntimeEnvironment(nidevice_grpc::kNiDeviceGrpcOriginalFileName, nidevice_grpc::kNiDeviceGrpcFileVersion, "", ""); } } diff --git a/source/codegen/templates/library.cpp.mako b/source/codegen/templates/library.cpp.mako index 6c388cb08..7795c126c 100644 --- a/source/codegen/templates/library.cpp.mako +++ b/source/codegen/templates/library.cpp.mako @@ -50,7 +50,7 @@ ${service_class_prefix}Library::${service_class_prefix}Library() : shared_librar % if 'SetRuntimeEnvironment' in service_helpers.filter_api_functions(functions, only_mockable_functions=False): if (function_pointers_.SetRuntimeEnvironment) { - this->SetRuntimeEnvironment(nidevice_grpc::kNiDeviceGrpcFileVersion, nidevice_grpc::kNiDeviceGrpcOriginalFileName, "", ""); + this->SetRuntimeEnvironment(nidevice_grpc::kNiDeviceGrpcOriginalFileName, nidevice_grpc::kNiDeviceGrpcFileVersion, "", ""); } % endif }