|
Re: Marshaling a byte array by ref: msg#00006windows.devel.jawin
Hi Al, First I must let you know that its been quite a while since I was almost "fluent" in VARIANT-arguments. So please don't take everything I write below as the "one-and-only" truth on VARIANT's :-) From your description I am still somewhat in doubt about whether your are using the COM-functionalities of Jawin (which I would expect when we are talking about VARIANTS) or whether your method is actually a DLL-exported "old-style" function using the VARIANT-types for some reason? So are you calling the function using a DispatchPtr, a COMPtr or a FuncPtr? If you are using a *FuncPtr*, Sean's and my comments from previous mails may be what you are looking for, although I fear that it would require manual formatting of the VARIANT structures from Java (I can't really remember how the marshalling code is on the native side, and whether it can handle 'v' and 'V' instruction strings. If you are using a *DispatchPtr* you should be using a Variant.ByrefHolder for your out variables: vTag must be VT_UI4 But I assume that for the above you means: vValue must be VT_ARRAY|VT_UI1 vinBuff must be VT_ARRAY|VT_UI1 (|VT_BYREF) vinfLen must be VT_ARRAY|VT_UI4 (|VT_BYREF) Also I am somewhat in doubt about how the method actually requires the caller to allocate vinBuff and send the length in vbuffSize? This is not how I previously worked with SAFEARRAY**'s. But perhaps some other VARIANT-experts on the list can help us on this? The VARIANT-documentation (as I read it) does not separate clearly between [in] and [out] VT_ARRAY. From http://msdn.microsoft.com/library/default.asp?url=/library/en-us/automat/html/e305240e-9e11-4006-98cc-26f4932d2118.asp it states both: SAFEARRAY * parray; // VT_ARRAY|*. and SAFEARRAY ** pparray; // VT_ARRAY|*. Thats why I put the VT_BYREF in () above. But one of the Jawin unittests actually contains some code showing how to call a method with an input SAFEARRAY and an output SAFEARRAY (both of type VT_ARRAY|VT_I4), with the signature: STDMETHOD(multiplySingleIntArray)(/*[in]*/ int multiplier, /*[in]*/SAFEARRAY* set, /*[out]*/SAFEARRAY** pOutset); In the DispatchTestBase#testMultiplySingleIntArrayInvoke()-method it is shown how to call this using the Variant.ByrefHolder http://jawinproject.cvs.sourceforge.net/jawinproject/jawin/test/org/jawin/DispatchTestBase.java?revision=1.4&view=markup This should also work for SAFEARRAYS of VT_UI1, i.e. Java byte[]. Hope this helps you a little further Best Regards Morten |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Marshaling a byte array by ref: 00006, Morten Andersen |
|---|---|
| Next by Date: | Re: Marshaling a byte array by ref: 00006, Al Harper |
| Previous by Thread: | Re: Marshaling a byte array by refi: 00006, Al Harper |
| Next by Thread: | Re: Marshaling a byte array by ref: 00006, Al Harper |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |