
problem of converting C's union type to VB's a data type
I have the header files, no need to post them. My point was
that this is irrelevant... every union is different. if you
*look* at the structure of a variant, you will see that the
struct of the variant is four variables and THEN a union...
meaning that you would have to change your C code to pad to
pad it with the likes of
{
VARTYPE vt;
WORD wReserved1;
WORD wReserved2;
WORD wReserved3;
before it ever gets to the Union. So using a variant here
will always fail in a struct that expects a Union with no
additional padding.
The point of converting VB structs to C structs is to make
sure the C code *thinks* that the data looks right. It will
never look right in this case if you use a Variant.
Michael
Quote:
> Looks like a union to me. Perhaps I didn't make myself
very clear to the
> original post. If an external API call requires the
address of a union (or
Quote:
> a pointer to a union), then no, using a variant will
probably not work.
> But in a translation from C to VB, using a variant where a
union was
> expected will simplify coding the same way a union
simplifies (some)
> coding in C.