LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Which C compiler is best for CIN/DLL on real-time target?

Hello,

I am developing an application that will run on an PXI-8176 controller running the most recent LabVIEW real-time OS.

This application will need to call some compiled C code using either CIN or as a shared library (DLL).

I need to purchase a C compiler for this purpose. Could people suggest what would be the best option? My host PC runs windows XP.

Also, as an aside, is using C++ an option, or is pure C the safest way to go?

Thanks in advance,
Frenk
0 Kudos
Message 1 of 6
(3,744 Views)
Hi Frenk,

National Instruments LabWindows/CVI ANSI C compiler supports the compilation of dll's for LV RealTime. It gives you feedback on which functions you can use and which you can't, as not all functions are supported on the RT Targets. Find more information on the link below

Programming for the LabVIEW Real-Time Module Using LabWindows/CVI
http://zone.ni.com/devzone/conceptd.nsf/webmain/619C8925F531EE7986256B110078E678?opendocument

Regards

Stephan A.

National Instruments
Message 2 of 6
(3,744 Views)
The drawback to using LabWindows/CVI is that it is a straight C compiler, not C++. But aside from that, it makes the task of building dll's for RT much easier.

If you really want/need to use C++, Microsoft Visual C++ will work fine. However, it won't give you feedback about which function you can and cannot use. So if you try to call a function which is not supported under RT, the DLL will fail to load, and you will not receive any feedback as to why it will not load.

Hope this helps,
Greg
0 Kudos
Message 3 of 6
(3,744 Views)
Hello,

Thank you both for your responses.

I have started compiling C code using LabWindows/CVI, and have successfully called a simple DLL function from within LabVIEW.

I have a question about the types defined in LabVIEW's extcode.h file:

These are defined to explicitly quantify the number of bits used for each data type (e.g. float64 instead of float) in order to eliminate ambiguity across compilers.

When I am using LabWindows/CVI to compile, do I need to use the LabView numeric types defined in LabView's extcode.h, or can I use the standard C types (int, float, etc.)?

Is there a distinction between having to use these special types for CIN versus shared library calls in LabVIEW?

Thanks in advance,
Frenk
0 Kudos
Message 4 of 6
(3,744 Views)
Hi Frenk,

I haven't gone through all the information, but the links below look to me like a good starting point:

External Code for LabVIEW - CIN / DLL - Starting Point
http://digital.ni.com/public.nsf/websearch/a6705fec7ea42300862567b70054206e

Creating Dynamic Link Library (DLL) in Microsoft Visual C++ 6.0 for use in LabVIEW
http://digital.ni.com/public.nsf/websearch/BDB89D1B9EEA138E86256CCD005C3AE7?OpenDocument

If you're familiar with german, this is a place with lots of information about external code in LV:

http://www.christian-hamp.de/LabVIEW/LV_ruft_auf/Windows_DLLs/windows_dlls.html

Regards

Stephan A.
National Instruments
0 Kudos
Message 5 of 6
(3,743 Views)
Thanks Stephan,

I read at those URLs, but there doesn't seem to be direct information regarding the special data types... I'm going to post to the main labview group, and see what people say.

Thanks,
Frenk
0 Kudos
Message 6 of 6
(3,743 Views)