LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Should I call C from LabVIEW or call LabVIEW from C?

I need to write some software and am trying to choose the best development environment. I currently use Borland C++ Builder to develop most of my software and have also used some LabVIEW occasionally. The new package I need to write has to provide several functions, some of which would be better in C++, some in LabVIEW and I am wondering whether to combine the two. So far, I have had a quick play around and called a very basic piece LabVIEW code, built into a dll, from some C++ code. I am about to try to reverse (create dll in C++ and call from LabVIEW) but would appreciate some advice on the advantages/disadvantages of each method.
 
Restrictions I have:
1. I will (probably) be using some hardware which will be supplied with C++ driver functions only. My interface with this card is the 'heart' of my system and is time-critical. Also, I need to assign a pointer to pass to this card (could I do this in LabVIEW?)
2. I wish to analyse data from the card using FFT and related functions so would ideally use the LabVIEW Sound & Vibration and Order Analysis toolkits. I need to use these in real-time where the data sampling rate is fairly high (frequency analysis to be done on 4 channels at once with each channel sampled at approx 100kHz).
 
To add to this, I would like to be able to create/modify the display screen at run-time - something which I am fine with in C++ but understand is very difficult in LabVIEW (I have only used LabVIEW for relatively simple systems and only really used LabVIEW 5 extensively - I am currently using V8.2 evaluation LabVIEW to help me make my design decision and would upgrade for this job).
 
Does anyone have any advice on how I can use C++ for my card interface and display manipulation whilst still using the toolkits on line analysis? If I build dlls from LabVIEW code and call them from C++ will I have any timing issues?
 
Thanks for any help.
0 Kudos
Message 1 of 2
(2,479 Views)
Hi,
 
I personally would use LabVIEW for the entire project since it seems that a large portion will involve using LV toolkits.  If your C++ drivers are in the form of DLLs, there is a good possibility you can call them from LV using the Call Library Function.  You can also pass pointers to the DLL from LV. For more information on calling external code, refer to LabVIEW Help under Fundamentals >> Calling Code Written in Text-Based Programming Languages. This method will allow you to use the toolkits easily since you are programming in LV. You should also be able to modify the display screen/front panel easily in LV during run-time depending on what you are trying to achieve.
 
However, if you cannot or don't want to use LV for some reason (DLL is incompatible, LV cannot run the hardware DLL functions fast enough, or already have existing C++ code), then you can definitely build DLLs for the portion of your code that uses the toolkits and call that from a C++ program.  I am not aware of any major performance degradation in timing from calling LV DLLs. 
 
Let me know if you have any more questions.
 
Way S.
NI UK Applications Engineer 
0 Kudos
Message 2 of 2
(2,442 Views)