LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

omitting CAN library

Solved!
Go to solution

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

0 Kudos
Message 1 of 4
(3,236 Views)

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

0 Kudos
Message 2 of 4
(3,216 Views)
Solution
Accepted by topic author Wolfgang

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

Message 3 of 4
(3,208 Views)

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

0 Kudos
Message 4 of 4
(3,196 Views)