The solution is to use the TVariantT structure which wraps a Windows VARIANT structure around VARIANT. TVariantT and TVariant are used to represent COM arguments and interfaces, just like the OleVariant class. However, TVariantT and TVariant are designed to work with C++Builder’s COM implementation classes that use the ATL, while OleVariant works with the VCL’s COM support.
The code to use for Borland's C++ Builder V4 for the TCWGraph example is the following:
TVariantT <(float)VARIANT> VarT2[100];
Variant vMean, vStdDev;
Variant data(OPENARRAY(int,(0,99)),varDouble);
int Bounds[2] = {0,99};
Variant A = VarArrayCreate(Bounds,1, varVariant);
int i;
for (i=0;i<100;i++) A.PutElement(rand()/10000.0,i);
//******TVariantT& operator
=(VARIANT& src)********
VarT2[0] = (VARIANT&) A;
CWGraph1->ClearData();
CWGraph1->PlotY(VarT2[0], 0, 1, true);
CWStat1->StdDev(VarT2[0], vMean, vStdDev);
MeanVal->Value = vMean;
StdDevVal->Value = vStdDev;