LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

extcode.h conflicts with toolbox.h?

Hi all,

  I have compiled some labview code to DLL in labview2012 so it can be called in the CVI. I have get it tested and it works pretty good. In the CVI program, I have to add extcode.h so the DLL can be used. Today, I have to include toolbox.h so I can use some functions there, but if I add #include<toolbox.h>, it fail to compile and the following errors shown up

 

competes.c - 9 errors
 "extcode.h"(553,55)   syntax error; found '>' expecting ')'.
 "extcode.h"(553,55)   Missing identifier.
 "extcode.h"(553,55)   syntax error; found '>' expecting ';'.
 "extcode.h"(553,55)   Unrecognized declaration.
 "extcode.h"(553,55)   syntax error; found ')' expecting ';'.
 "extcode.h"(553,55)   Unrecognized declaration.
 "extcode.h"(553,55)   syntax error; found ')' expecting ';'.
 "extcode.h"(553,55)   Unrecognized declaration.
 "extcode.h"(553,55)   syntax error; found ')' expecting ';'.

 

and in extcode.h, the problem code is

/** @brief Computes min of two numbers.
    @param n the first integer argument
    @param m the second integer argument
    @return the min of n and m */
TH_REENTRANT EXTERNC int32 _FUNCC Min(int32 n, int32 m);

/** @brief Computes max of two numbers.
    @param n the first integer argument
    @param m the second integer argument
    @return the max of n and m */
TH_REENTRANT EXTERNC int32 _FUNCC Max(int32 n, int32 m);
#endif /* !Palm */

#if (ProcessorType==kX86) || (ProcessorType==kM68000)
    #define UseGetSetIntMacros    1
#else
    #define UseGetSetIntMacros    0
#endif

#if UseGetSetIntMacros
    #define GetAWord(p)        (*(int16*)(p))
    #define SetAWord(p,x)    (*(int16*)(p)= x)
    #define GetALong(p)        (*(int32*)(p))
    #define SetALong(p,x)    (*(int32*)(p)= x)
#else
TH_REENTRANT EXTERNC int32 _FUNCC    GetALong(const void *);
TH_REENTRANT EXTERNC int32 _FUNCC    SetALong(void *, int32);
TH_REENTRANT EXTERNC int16 _FUNCC    GetAWord(const void *);
TH_REENTRANT EXTERNC int16 _FUNCC    SetAWord(void *, int16);
#endif

I don't understand why it causes problems.

0 Kudos
Message 1 of 5
(3,650 Views)

There is a KB that talks about this issue here. I am not sure what your LabVIEW does, does it include DAQmx APIs?

National Instruments
Applications Engineer
0 Kudos
Message 2 of 5
(3,618 Views)

@Edna-S wrote:

There is a KB that talks about this issue here. I am not sure what your LabVIEW does, does it include DAQmx APIs?


Hi there,

  Thanks for the reply. I carefully trace the error and I figure out for my case it is the max and min function conflicts cause that. I comment out those function in the extcode.h fix the problem.

 

p.s. I did use DAQmx API and have the header included too

0 Kudos
Message 3 of 5
(3,600 Views)

Glad to hear problem is fixed now, and thanks for sharing the solution

National Instruments
Applications Engineer
0 Kudos
Message 4 of 5
(3,589 Views)

@Edna-S wrote:

Glad to hear problem is fixed now, and thanks for sharing the solution


Hi Edna-S, although it if solved, actually I temporarily commented out that functions (Min and Max) since I am not using Min and Max function in the application. But in case in other application we need that funciton then it will conflict the function names. It is the problem of C lanuage that there is no namespace so the function cannot be of the same name.

0 Kudos
Message 5 of 5
(3,576 Views)