fixed bad alloc and added missing unix lv_interop function loading #372
+10
−16
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.
I am working on some changes to the C++ build tooling and dll linkage (see #144) and noticed that the memory size allocation in
OccurServerEvent
function is likely 1 byte too big on 32-bit platforms and 3 bytes too small on 64-bit platforms (dependant on the LV array/string byte-packing) . You would have to be pretty unlucky to have something important allocated in the bytes that get "borrowed" on 64-bit systems but it seemed worth fixing.As we are trying to create a LabVIEW-string from a
std::string
we can use the existingSetLVString
function to allocate and copy thestd::string
into something we can use to callPostUserEvent
.Clean-up of the handle is done with
DSDisposeHandle
Strangley,
InitCallbacks
function only gets the address ofDSDisposeHandle
on Windows so I added the code so both platforms load the same functions.Finally - I removed the call in
InitCallbacks
which would make the LabVIEW IDE or the RTE exit on a shared-library load error on Linux platforms. It is better to rely on LabVIEW's rudimentary shared-library call fault handling than to just make the whole IDE/Application exit with little indication to the user as to what happened but I am happy to discuss if you feel differentlyCheers