logo       

Re: Marshaling a byte array by ref: msg#00008

windows.devel.jawin

Subject: Re: Marshaling a byte array by ref

Hi Al,

Ok. Then I think we have a problem. I looked into the native marshalling
in Transform.cpp, and for VT_BYREF combined with "simple" types, like
e.g. VT_UI1 we set the VARIANT reference (e.g. for VT_BYREF|VT_UI1:
*pbVal in the VARIANT-struct) to point to a *one-byte* allocated reference.

This is the source from Transform.cpp which takes care of this (you can
see that we only SafeMalloc one byte:

byte* pbyte = (byte*)MarshalAllocator::SafeMalloc(sizeof(byte), m_pbr);
// set the value to the java-value (if any)
*pbyte = (byte)in.readByteOrDie();
// and finally write the pointer to the out stream
out.writeIntOrDie((int)pbyte);

So I am pretty sure that your request can only be satisfied by adding
support for this in both the CPP and Java-marshalling code. That would
also require some thought on what java-types should marshal into this. E.g.
- a ByrefHolder(byte[])-instance is already used for marshalling to
VT_ARRAY|VT_UI1|VT_BYREF.
- a simple byte[]-instance is already used for marshalling to
VT_ARRAY|VT_UI1.

Unfortunately I don't have the equipment (I am mostly on Mac lately),
software tools (VC++) or time for working out such a change right now.

So to answer your originally question in short:
"Can JAWIN marshall a byte array by ref?"

We unfortunately only support to marshall to VARIANT SafeArray's, and
don't support plain-old-style C byte*-arrays. We only support these for
old-style DLL exported functions.

Sorry to disappoint you.
Best Regards
Morten



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise