Quantcast
Channel: LabWindows/CVI topics
Viewing all articles
Browse latest Browse all 5357

Problems with typedef uInt32 and NI Vision

$
0
0

Hi,

 

I'm having a bit of a problem building my application against the headers provided by NI Vision Acquistion 15.0 and CVI 2012SP1.  The problem seems to be conflicting typedefs in the header files related to the "uInt32" and "SESSION_ID" types.  In NIIMAQdx.h, there's this:

 

#ifndef _NI_uInt32_DEFINED_
    #define _NI_uInt32_DEFINED_
    #if defined(_MSC_VER)
        typedef unsigned long       uInt32;
    #else
        typedef unsigned int        uInt32;
    #endif
#endif

 

Now, _MSC_VER is not defined, so we get uInt32 defined as a unsigned int.  In niimaq.h there's:

 

#ifndef _NI_uInt32_DEFINED_
    #define _NI_uInt32_DEFINED_
    #if defined(_MSC_VER)
        typedef unsigned long       uInt32;
    #elif __GNUC__
        #if __x86_64__
            typedef unsigned int    uInt32;
        #else
            typedef unsigned long   uInt32;
        #endif
    #endif
#endif

 

Which since neither _MSC_VER or __GNUC__ is defined, does nothing except define _NI_uInt32_DEFINED_ which prevernts it from being defined by another header.  niimaq.h also has this in it:

 

typedef  uInt32   INTERFACE_ID;
typedef  uInt32   SESSION_ID;
typedef  uInt32   EVENT_ID;
typedef  uInt32   PULSE_ID;
typedef  uInt32   BUFLIST_ID;
typedef  Int32    IMG_ERR;
typedef  uInt16   IMG_SYNC;
typedef  uInt32   GUIHNDL;

 

Which means that by itself, a module that includes niimaq.h won't build because uInt32 never gets defined.  You can include NIIMAQdx.h before it so that it cand defrine uInt32 (as unsigned int), which works except that nivision.h has this line int it:

 

typedef unsigned long SESSION_ID;

 

So once again it won't compile due to the conflicting types (unsigned int versus unsigned long).  It seems that there is no way to include niimaq.h, nivision.h, and NIIMAQdx.h in the same .c file, no matter the order, without some conflict or unknown types.  Comparing back to an older version (3.9.1), I see in NIMAQdx.h,

 

#ifndef _NI_uInt32_DEFINED_
    #define _NI_uInt32_DEFINED_
        typedef unsigned long       uInt32;
#endif

 

Which is nice and simple.  niimaq.h also has the exact same code in it too for NI-IMAQ 4.6.1.  This does imply that I can "fix" it by defining _MSC_VER, and indeed putting

#define _MSC_VER 1300

At the top of my .c file does indeed get things to build, but I'm leary of doing this because I know there are other things that appear to key off of this.

 

Any ideas or is the solution to roll back to an older version of the Vision Acquisition?  Thanks.


Viewing all articles
Browse latest Browse all 5357

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>