|
|
variant data type
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
|
|
0
|
|
|
|
Reply
|
Lynn
|
6/29/2010 12:21:47 AM |
|
In article <i0beav$ps2$1@news.eternal-september.org>,
Lynn McGuire <lmc@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
|
|
0
|
|
|
|
Reply
|
Ron
|
6/29/2010 2:04:36 AM
|
|
"Ron Shepard" <ron-shepard@NOSPAM.comcast.net> wrote in message
news:ron-shepard-EAE3DE.21043628062010@news60.forteinc.com...
> In article <i0beav$ps2$1@news.eternal-september.org>,
> Lynn McGuire <lmc@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
|
|
0
|
|
|
|
Reply
|
e
|
6/29/2010 4:11:49 AM
|
|
> 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
|
|
0
|
|
|
|
Reply
|
Lynn
|
6/30/2010 7:00:11 PM
|
|
|
3 Replies
436 Views
(page loaded in 0.097 seconds)
|
|
|
|
|
|
|
|
|