LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CVI fails to compile extcode.h (labview include file) and any toolbox fp file in CVI

I have the same problem, and I know, it's possible to use the workaround you explained (making a local copy of extcode.h and modifying it), but I think It would be better if someone from NI solved this linker conflict between NI components.

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 11 of 14
(2,122 Views)

This kind of redeclaration error is a frequent problem when mixing different C libraries - they export functions of the same name and this results in compile (*not* link) errors. The common solution to this problem is to redeclare the conflicting functions after including the first file and before including the second, as follows:

#include <extcode.h>
#define Pin        LVPin
#define SwapBlock  LVSwapBlock
#define BinSearch  LVBinSearch

#include <toolbox.h>

Neither LabVIEW nor CVI can workaround this without dropping support for these functions, breaking backwards compatibility, etc. This is one good reason to prefix C functions with some kind of 'namespace' qualifier - like 'MyLib_'.

0 Kudos
Message 12 of 14
(2,092 Views)
Better,

#include <extcode.h>
#define Pin        CVIPin
#define SwapBlock  CVISwapBlock
#define BinSearch  CVIBinSearch
#include <toolbox.h>

/* OR */

#define Pin        LVPin
#define SwapBlock  LVSwapBlock
#define BinSearch  LVBinSearch
#include <extcode.h>
#undef Pin
#undef SwapBlock
#undef BinSearch

#include <toolbox.h>

Of course, there is no need to copy or edit the include files - which is not a good idea, anyway.
Message 13 of 14
(2,080 Views)


@Mohan wrote:
Better,

#include
#define Pin        CVIPin
#define SwapBlock  CVISwapBlock
#define BinSearch  CVIBinSearch
#include

/* OR */

#define Pin        LVPin
#define SwapBlock  LVSwapBlock
#define BinSearch  LVBinSearch
#include
#undef Pin
#undef SwapBlock
#undef BinSearch

#include

Of course, there is no need to copy or edit the include files - which is not a good idea, anyway.


Thanks a lot! I was just wondering about my understanding of C preprocessor defines. Smiley Very Happy

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 14 of 14
(2,073 Views)