Re: VT_NULL becomes VT_UNKNOWN
Morten Andersen <[email protected]> Wed, 27 Jul 2005 19:21:59 +0200
| Newsgroups | gmane.comp.windows.devel.jawin |
|---|---|
| Message-ID | <[email protected]> |
Hi Claude,
Claude Eisenhut wrote:
> I use DipatchPtr.put("attrname",null)
>
> JAVA:Variant.writeObject() translates this to VT_NULL (as documented).
> However CPP:Transform::deserializeVariant() transforms VT_NULL to
> VT_UNKNOWN(0). Any ideas why?
>
A very good question. I cleaned up the Variant marshalling last summer
(I think), but I don't think I added this special handling for VT_NULL?
I assume the correct thing to do, is to marshall to VT_NULL as you
suggest, but I am not sure the standard marshalling for VT_UNKNOWN can
support marshalling to VT_UNKNOWN(0), so I will have to check whether
there is anywhere inside Jawin where we use this particular marshalling.
> My COM object expects VT_NULL. How can I set this?
I don't think that it is possible the way the native code is implemented
:-(. Are you able to build the native code yourself? In that case I
suggest you try to change the following in Transform::deserializeVariant():
if (vt == VT_NULL) {
out.writeShortOrDie(VT_NULL); <----- THIS LINE IS CHANGED
// fill the rest of the out variant with 0
out.writeNBytesOrDie(0, sizeof(VARIANT) - sizeof(VARTYPE));
return;
}
Please let me know if this gives any other problems?
Good luck and best regards
Morten