|
On 23.08.2010, at 23:16, Schwab,Wilhelm K wrote:
> Andreas,
>
> Thanks for code, but should this not be in the image, associated in some way with ExternalAddress and/or ByteArray?
>
> Can I simply use a ByteArray to make a buffer that I pass to an external library? My understanding is that it could be moved by the gc (ouch!!) Am I wrong? If there is a way to instantiate a byte array that won't move, great.
It won't move while you are calling that library. But it can move after return. So as long as the library does not retain a pointer to the buffer, this will work fine.
If the lib *does* retain the pointer, use ExternalAddress allocate: or gcallocate: to make the buffer, and memcpy to fill it quickly or retrieve the data.
- Bert -
|