USBI2CIO Header File Update Information 

The Errors:

1. The original header file contained the following line:

#pragma pack(1) // force byte alignment.

2.  The original header file had function prototypes for unimplemented functions.

The Problems:

1. While the original pack pragma worked fine with our example code, it sometimes caused serious problems when customers tried to include it in their own applications.

Typically, the customer application would be unstable, and malfunction.  Attempts to track down this problem with a debugger tended to indicate a problem existed in some other (non DeVaSys) code.   Often, the MFC class libraries would seem to be the source of the problem.

After considerable effort on the part of one of our customers and the folks at Microsoft, the problem was found to be the result of the pack pragma in the usbi2cio.h file.  Once encountered, the pack pragma affected the packing of all subsequent structures in the customer's application, setting their alignment to 1 byte.

2.  Customers were confused when they tried to use unimplemented USBI2CIO function calls.

The Fixes:

1.  The original pack pragma line has been modified and a second pack pragma line has been added.  The result of this fix is that the packing is only modified for our structures, and is then restored so as not to affect the user's application.

#pragma pack(push, 1) // force byte alignment

typedef struct _I2C_TRANS { BYTE byTransType;
BYTE bySlvDevAddr;
WORD wMemoryAddr;
WORD wCount;
BYTE Data[256];
} I2C_TRANS, *PI2C_TRANS;

#pragma pack(pop) // restore previous alignment

2.  The function prototypes have been divided into two section, "implemented" and "unimplemented".