11-02-2011 10:16 AM
I am using LabView 8.5 on linux (OpenSUSE).
Because IMAQ is not available for LabView on linux, I used the library 'dc1394' to control a firewire(IEEE1394) interface camera.
First, I made a program and compile it directly by gcc compiler, and the performance was quite well.
Then I used the same code to generate a CIN on labview.
But the performance was just reallly bad, I could not even switch to other desktops...
Anyone has any ideas?
Thanks!
11-14-2011 07:50 AM
Hello,
I think it is better to generate a ".dll-file" with your program and integrate it
in LabVIEW with the "Call Library Function Node".
Here a link for better understanding:
https://decibel.ni.com/content/docs/DOC-9069
I hope that could help you with your problem.
If you have further questions, feel free to contact us!
Best regards
Johannes Winkler
Application Engineering
National Instruments
11-14-2011 10:25 AM - edited 11-14-2011 10:25 AM
Thanks.
But how can I compile C header files into dll files?
11-15-2011 02:44 AM
Hello again,
you can use the DLL creation wizard in LabVIEW:
Go to the LabVIEW start window -> select "Tools" -> select "Import" ->
choose "Shared Library (.dll)"
Now you can select your "dll-file" and you "header-file" in the following dialog.
LabVIEW generates the project with the "Call Library Function Node" automatically.
Furthermore you can choose error handling in that dialog.
I hope that could help you!
Best regards!
Johannes
11-15-2011 08:12 AM
Um... the poster is on Linux. Should they not be creating shared libraries instead of DLLs?
11-17-2011 09:19 AM
Okay, I followed the steps described by this: https://decibel.ni.com/content/docs/DOC-9069
but import *.so library files instead of .dll files.
And I do find the functions I need to call in the list of "Call Library Function" window.
But there is a problem: the data types of parameters I can choose are limited to numeric, string, array...etc.
However, if I use the functions provided by the .so file, I would need to use parameters with stucture data type which is defined in some header files.
So how can I pass the parameters with special structure data type between functions?
Thanks again!
11-18-2011 07:52 AM
There is no simple answer to your question. It depends if the C structure contain only fixed size data or also variable sized data (array and string pointers). If they are fully fixed size, you can simply create a LabVIEW Cluster that implements the same memory image and pass it to the Call Library Node Parameter, by configuring that parameter as Adapt to Type. Fixed size arrays inside the structure are implemented by an embedded LabVIEW Cluster with the correct number of compatible elements inside. You do have to watch out for structure element alignment on Windows 32Bit, as LabVIEW uses packed bytes for structures there. For Linux the alignment used by LabVIEW should be the same as the default alignment.
If your structure contains any type of pointer, it's going to be a lot more painful to interface the according functions to LabVIEW and my recommended path for these scenarios is to write a wrapper shared library that translates between LabVIEW native string and array handles and C string and array pointers.