Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/ni/grpc-labview
Browse files Browse the repository at this point in the history
  • Loading branch information
ccifra committed Apr 12, 2021
2 parents 19fafef + b55b4d9 commit e0a89e6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/event_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ LVMessage::~LVMessage()
google::protobuf::Message* LVMessage::New() const
{
assert(false); // not expected to be called
return NULL;
return nullptr;
}

//---------------------------------------------------------------------
Expand Down Expand Up @@ -1235,7 +1235,7 @@ GenericMethodData::GenericMethodData(CallData* call, ServerContext *context, std
//---------------------------------------------------------------------
//---------------------------------------------------------------------
ServerStartEventData::ServerStartEventData()
: EventData(NULL)
: EventData(nullptr)
{
serverStartStatus = 0;
}
2 changes: 1 addition & 1 deletion src/grpc_interop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ LIBRARY_EXPORT int32_t RegisterMessageMetadata(LVgRPCServerid* id, LVMessageMeta
//---------------------------------------------------------------------
//---------------------------------------------------------------------
LIBRARY_EXPORT int32_t RegisterServerEvent(LVgRPCServerid* id, const char* name, LVUserEventRef* item, const char* requestMessageName, const char* responseMessageName)
{
{
auto server = *(LabVIEWgRPCServer**)id;

server->RegisterEvent(name, *item, requestMessageName, responseMessageName);
Expand Down
29 changes: 18 additions & 11 deletions src/lv_interop.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//---------------------------------------------------------------------
//---------------------------------------------------------------------
#include <lv_interop.h>
#include <iostream>
#include <cstring>
#include <memory>

Expand All @@ -19,26 +20,26 @@ typedef int (*PostLVUserEvent_T)(LVUserEventRef ref, void *data);

//---------------------------------------------------------------------
//---------------------------------------------------------------------
static NumericArrayResize_T NumericArrayResize;
static PostLVUserEvent_T PostLVUserEvent;
static NumericArrayResize_T NumericArrayResize = nullptr;
static PostLVUserEvent_T PostLVUserEvent = nullptr;

#ifdef _WIN32

//---------------------------------------------------------------------
//---------------------------------------------------------------------
void InitCallbacks()
{
if (NumericArrayResize != NULL)
if (NumericArrayResize != nullptr)
{
return;
}

auto lvModule = GetModuleHandle("LabVIEW.exe");
if (lvModule == NULL)
if (lvModule == nullptr)
{
lvModule = GetModuleHandle("lvffrt.dll");
}
if (lvModule == NULL)
if (lvModule == nullptr)
{
lvModule = GetModuleHandle("lvrt.dll");
}
Expand All @@ -52,18 +53,24 @@ void InitCallbacks()
//---------------------------------------------------------------------
void InitCallbacks()
{
if (NumericArrayResize != NULL)
if (NumericArrayResize != nullptr)
{
return;
}

auto lvModule = dlopen("labview", RTLD_NOLOAD);
if (lvModule == NULL)
auto lvModule = dlopen(nullptr, RTLD_LAZY);
if (lvModule != nullptr)
{
NumericArrayResize = (NumericArrayResize_T)dlsym(lvModule, "NumericArrayResize");
PostLVUserEvent = (PostLVUserEvent_T)dlsym(lvModule, "PostLVUserEvent");
}
if (NumericArrayResize == nullptr)
{
cout << "Loading LabVIEW Runtime engine!" << endl;
lvModule = dlopen("liblvrt.so", RTLD_NOW);
NumericArrayResize = (NumericArrayResize_T)dlsym(lvModule, "NumericArrayResize");
PostLVUserEvent = (PostLVUserEvent_T)dlsym(lvModule, "PostLVUserEvent");
}
NumericArrayResize = (NumericArrayResize_T)dlsym(lvModule, "NumericArrayResize");
PostLVUserEvent = (PostLVUserEvent_T)dlsym(lvModule, "PostLVUserEvent");
}

#endif
Expand Down Expand Up @@ -96,7 +103,7 @@ void SetLVString(LStrHandle* lvString, string str)
//---------------------------------------------------------------------
string GetLVString(LStrHandle lvString)
{
if (lvString == NULL || *lvString == NULL)
if (lvString == nullptr || *lvString == nullptr)
{
return string();
}
Expand Down

0 comments on commit e0a89e6

Please sign in to comment.