SAFEARRAY SafeArrayCreate SafeArrayDestroy
// Specify the bounds: // -- dim. count = 2 // -- element count = 8 for each dimension // -- low bound = 0 for each dimension SAFEARRAYBOUND mySafeArrayBounds[2] = { {8, 0}, {8, 0}}; // Create mySafeArray SAFEARRAY *mySafeArray = SafeArrayCreate(VT_I2 /* var. type: 2 byte signed int */ , 2 /* dim. count */ , mySafeArrayBounds); // Set value 100 to element [3][7] int16_t *elementPtr = ((int16_t*)mySafeArray->pvData) + 3 * mySafeArray->rgsabound[0].cElements + 7; *elementPtr = 100; // Destroy mySafeArray SafeArrayDestroy(mySafeArray);