shadows wrote:
>
> Hi,
> I have the following C++ function:
>
> bool test(BYTE *bpBuffer,DWORD iBufferLength) {
> // write into Buffer
> // write new value into BufferLenght
> }
>
> Is this XPIDL definition right?
>
> boolean test(out octet bBuffer, inout unsigned long bBufferLength)
>
> And how would I pass arguments from JavaScript?
> I tryed:
> ...
> ...
> var Buffer=new Object();
> var BufferLength=new Object();
> BufferLength.value=100;
> test(Buffer,BufferLength);
>
> But I get a Memory Exception saying that "read" can't be executed in memory
> 0x0000004 or something like that...
>
> Thanx for any help
I just added a bunch of old posting on arrays to the xpconnect
faq...
http://mozilla.org/scriptable/faq.html#i11
Why would bBuffer be 'out' while bBufferLength is 'inout'?
What good is the bool result? Why not use the success or failure
of the nsresult or one of the values already passed to indicate
validity?
You need to use [array] and follow its rules if you want to call
something like this from xpconnect. See the info above, write the
idl, and make a C++ implementation to match the signature of the
generated header - you'll end up with an extra pointer
indirection that your code above does not have.
John.