03-18-2009 01:20 PM
Hi,
I have a measurement program written in CVI that supports several instruments; communication is via serial, TCP, GPIB, or CAN interfaces.
Now I want the same program to compile (and run) on a computer that has no CAN instrument, and thus no CAN library is installed.
The executable has a configuration option that enables/disables CAN instrument support, so the lack of the instrument doesn't hurt if the switch is set properly.
The idea is that I can work on the program on my notebook as along as I do not need to work on the CAN related functions.
However, I cannot compile the code without the CAN library installed, because function prototypes exist that include constants such as NCTYPE - hence without the library I receive compilation errors.
Thanks for assistance,
Wolfgang
Solved! Go to Solution.
03-19-2009 11:18 AM
I may add that NI-CAN is not supported on XP64, so there seems to be no possibility to work on my code as soon as I include the CAN library, even if I want to modify CAN-free routines only.
What I am looking for is a possibility to include a 'dummy library' or file that includes all NC-definitions once the CAN is unavailable, or a suitable macro etc. to disable all CAN-related function calls in my source code, permitting the compilation of the code for test purposes without the library.
Is it possible?
Thanks, Wolfgang
03-19-2009 12:53 PM
Presuming your CAN-related implementation is fairly isolated, one possibility would be to wrap all that code in a preprocessor conditional like #ifndef CAN_NOT_SUPPORTED. When developing on your laptop, you would add CAN_NOT_SUPPORTED to the compiler defines found under Options>>Build Options dialog.
Mert A.
National Instruments
03-20-2009 02:26 AM
Thanks Mert! The compiler define (/DCAN_NOT_AVAILABLE=1) indeed did solve my problem! I only have to include a line
#ifndef CAN_NOT_AVAILABLE
in the include file of all my CAN functions, and all complaints of the compiler are gone 🙂
And I've got to know the compiler define feature...
Wolfgang