LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read io using a .lib file, how to load the .lib file, how to see the io

I'm trying to load the .lib files, for example: Optitrack's NatNetSDK's lib/x64/NatNetLib.lib

which contains:

NatNetLib.dll, NatNetLib.lib, NatNetML.dll, NatNetML.xml

 

Here's the tree:

NatNetSDK
├── include
│   ├── NatNetCAPI.h
│   ├── NatNetClient.h
│   ├── NatNetRepeater.h
│   ├── NatNetRequests.h
│   └── NatNetTypes.h
├── lib
│   └── x64
│   ├── NatNetLib.dll
│   ├── NatNetLib.lib
│   ├── NatNetML.dll
│   └── NatNetML.xml

 ...

 

 

Every tutorial I've found just plain do not work, are not what i'm searching for, are for dll loading, which doesn't work here because there's multiple dll who seems to be requiring multiple .h files each. 

And the one who seemed to be good was from 15 years ago with windows vista.

 

I'm completely new to labview, I'm running LabView 2024 Q3

Do not assume I know where every menu option is, as "Select from VI" just isn't in the right click menu or any menu at the top. 

 

 

Thank you for your time. 

0 Kudos
Message 1 of 11
(514 Views)

Btw, I couldn't find the Call Library Function either. 

0 Kudos
Message 2 of 11
(512 Views)

Hi motion,

 


@motioncapurelab wrote:

Btw, I couldn't find the Call Library Function either. 


Ctrl-Space to open the QuickDrop window, then type "Call"…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 11
(468 Views)

Ok, i can load the .dlls, not .lib, which are static libraries.

Now, how do i point to header files, having a dll without headers is kinda useless.

0 Kudos
Message 4 of 11
(439 Views)

Hi Motion,

 


@Motion_capture_Lab_Home wrote:

Ok, i can load the .dlls, not .lib, which are static libraries.

Now, how do i point to header files, having a dll without headers is kinda useless.


What exactly should "point to header files"?

The CLFN (CallLibraryFunctionNode) just needs the DLL path…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 11
(413 Views)

Well, it has the wrong types. 

 

The function uses struct. So XYZ float points inside a struct, inside a struct,... 

 

Labview forces me to have primitive types on everything

 Input. Args. Output. 

0 Kudos
Message 6 of 11
(410 Views)

Hi Motion,

 


@Motion_capture_Lab_Home wrote:

The function uses struct. So XYZ float points inside a struct, inside a struct,... 

 

Labview forces me to have primitive types on everything Input. Args. Output. 


Write a wrapper in C to handle the structs and provide simple datatypes to LabVIEW…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 11
(405 Views)

Ok, but can Labview recieves arrays? 

0 Kudos
Message 8 of 11
(402 Views)

@Motion_capture_Lab_Home wrote:

Ok, but can Labview recieves arrays? 


No, but it can pass arrays of scalars to the functions. C memory management is involved and the least problematic is that the caller ALWAYS allocates any memory and passes it to the function and the function either reads the memory contents or writes something into it. If you configure a Call Library Parameter as Array of any Integer or Floating Point type, passed as C data pointer, LabVIEW will pass that array to the function as a C pointer.

Important is that you need to preallocate such an array. For an input parameter this is obvious, you need to pass the elements in that the function needs to read, but for an output parameter you have to ALSO allocate the array with as many elements as the function is documented to need at most. This can be either an implicit fixed number of elements that needs to be documented in the function documentation, or it can be explicit in which case the number of elements the preallocated array has, is passed in an extra parameter so that the function can verify that the array is big enough for the information it wants to use. Often the function also returns in that case an extra parameter that indicates how many elements were actually filled in.

Rolf Kalbermatter
My Blog
0 Kudos
Message 9 of 11
(396 Views)

Ok. 

So, is it malloc or calloc allocated,

Or from int array[5],

 

and labview needs to know the number of points in the array. 

 

Or they'd all work. 

 

Btw, thank you for your time. 

0 Kudos
Message 10 of 11
(381 Views)