pitrou edited a comment on pull request #8287:
URL: https://github.com/apache/arrow/pull/8287#issuecomment-704423199
You're doing it wrong. I suggest again that you try to follow how C++ does
things, otherwise you'll get lost.
For example, your `release` callback assumes that buffers have been
allocated by Rust. This is trivially wrong if e.g. roundtripping from Python to
Rust to Python.
So, what needs to happen is you have something like this (not necessarily
working, but you get the idea):
```rust
struct ExportedArrayData {
buffers: Vec<Buffer> buffers,
// other stuff perhaps...
};
```
Then your `private_data` must point to an heap-allocated
`ExportedArrayData`. Your `release` callback will cast back `private_data` to
`ExportedArrayData` and destroy it (releasing all the buffers). This can
probably be done using:
* `private_data = Box::new(ExportedArrayData...).into_raw() as *mut c_void`
when exporting
* `Box::from_raw(private_data as *mut ExportedArrayData)` in the release
callback
And again, I suggest you tackle importing and exporting separately.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]