From: Lynn McGuire on
How would one support a variant data type in modern (post f77) ? I am
writing some OLE code today (in C++ though) and have run across the OLE
VARIANT data type: http://docstore.mik.ua/orelly/perl3/perlnut/ch23_04.htm

I would either use equivalences or a structure / map / union / record.

Thanks,
Lynn




From: Ron Shepard on
In article <i0beav$ps2$1(a)news.eternal-september.org>,
Lynn McGuire <lmc(a)winsim.com> wrote:

> How would one support a variant data type in modern (post f77) ? I am
> writing some OLE code today (in C++ though) and have run across the OLE
> VARIANT data type: http://docstore.mik.ua/orelly/perl3/perlnut/ch23_04.htm
>
> I would either use equivalences or a structure / map / union / record.

This is for passing some item to a routine in another language, right?
I would probably pack/unpack the bits using either transfer() or
internal I/O.

$.02 -Ron Shepard
From: e p chandler on

"Ron Shepard" <ron-shepard(a)NOSPAM.comcast.net> wrote in message
news:ron-shepard-EAE3DE.21043628062010(a)news60.forteinc.com...
> In article <i0beav$ps2$1(a)news.eternal-september.org>,
> Lynn McGuire <lmc(a)winsim.com> wrote:
>
>> How would one support a variant data type in modern (post f77) ? I am
>> writing some OLE code today (in C++ though) and have run across the OLE
>> VARIANT data type:
>> http://docstore.mik.ua/orelly/perl3/perlnut/ch23_04.htm
>>
>> I would either use equivalences or a structure / map / union / record.
>
> This is for passing some item to a routine in another language, right?
> I would probably pack/unpack the bits using either transfer() or
> internal I/O.
>
> $.02 -Ron Shepard

IIRC, DVF/CVF/IVF treat a variant as a derived type, but the innards are
buried in supplied modules and libraries.

I've only done Office Automation from VBA, where it's easy. Yes, some people
deride VB/VBA as junk. Whether its wretchedness under the hood is deserved,
I don't know.

Elliot




From: Lynn McGuire on
> How would one support a variant data type in modern (post f77) ? I am
> writing some OLE code today (in C++ though) and have run across the OLE
> VARIANT data type: http://docstore.mik.ua/orelly/perl3/perlnut/ch23_04.htm

Here is the C version from from oaidl.h:

typedef /* [wire_marshal] */ struct tagVARIANT VARIANT;

struct tagVARIANT
{
union
{
struct __tagVARIANT
{
VARTYPE vt;
WORD wReserved1;
WORD wReserved2;
WORD wReserved3;
union
{
LONGLONG llVal;
LONG lVal;
BYTE bVal;
SHORT iVal;
FLOAT fltVal;
DOUBLE dblVal;
VARIANT_BOOL boolVal;
_VARIANT_BOOL bool;
SCODE scode;
CY cyVal;
DATE date;
BSTR bstrVal;
IUnknown *punkVal;
IDispatch *pdispVal;
SAFEARRAY *parray;
BYTE *pbVal;
SHORT *piVal;
LONG *plVal;
LONGLONG *pllVal;
FLOAT *pfltVal;
DOUBLE *pdblVal;
VARIANT_BOOL *pboolVal;
_VARIANT_BOOL *pbool;
SCODE *pscode;
CY *pcyVal;
DATE *pdate;
BSTR *pbstrVal;
IUnknown **ppunkVal;
IDispatch **ppdispVal;
SAFEARRAY **pparray;
VARIANT *pvarVal;
PVOID byref;
CHAR cVal;
USHORT uiVal;
ULONG ulVal;
ULONGLONG ullVal;
INT intVal;
UINT uintVal;
DECIMAL *pdecVal;
CHAR *pcVal;
USHORT *puiVal;
ULONG *pulVal;
ULONGLONG *pullVal;
INT *pintVal;
UINT *puintVal;
struct __tagBRECORD
{
PVOID pvRecord;
IRecordInfo *pRecInfo;
} __VARIANT_NAME_4;
} __VARIANT_NAME_3;
} __VARIANT_NAME_2;
DECIMAL decVal;
} __VARIANT_NAME_1;
} ;


Whew!,
Lynn
 | 
Pages: 1
Prev: Fortran Vs C, C++, C#
Next: PR1ME OPERATING SYSTEM