esodan opened a new issue, #1280:
URL: https://github.com/apache/arrow-adbc/issues/1280

   The C API could be correct and useful *as is*, but when switch to Vala using 
`void*` doesn't feet Vala's automatic memory management, as we need to tell it 
if the pointer should or not be freed. In other words `void*` means manual 
memory management, and that push back the advantage of Vala for GObject.
   
   For `GADBC.Statement`, currently there are this API:
   ```c
   gboolean gadbc_statement_bind(GADBCStatement* statement, gpointer 
c_abi_array,
                                 gpointer c_abi_schema, GError** error);
   
   gboolean gadbc_statement_bind_stream(GADBCStatement* statement,
                                        gpointer c_abi_array_stream, GError** 
error)
   ```
   
   The C comments declares `gpointer c_abi_array` and `gpointer 
c_abi_array_stream` as `out` parameters, but the pointer in not a pointer to 
pointer (`void**`), so should not be declared as it.
   
   But when looking to a better GObject API, the C API should be:
   
   ```c
   gboolean gadbc_statement_bind(GADBCStatement* statement, GArrow.Array *array,
                                 GArrow.Schema *schema, GError** error);
   
   gboolean gadbc_statement_bind_stream(GADBCStatement* statement,
                                        GArrow.InputStream *stream, GError** 
error)
   ```
   
   Internally, the above statements should use `*_get_raw()` methods to get the 
native `Arrow` structures and fill out them with the provided data.
   
   I'm not quite sure if `c_abi_array_stream` is a `GArrow.InputStream` or an 
`GArrow.OutputStream`, so please guide me here, because there is not a generic 
`GArrow.Stream` to use here.
   
   This issue is affecting #1152 because the current API forces to manual 
memory management, that is not a good idea, both in C and in Vala.


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to