additional C api functions
Posted: Sat May 24, 2014 9:17 pm
I find there is a lack of C API functions for dereferencing non-aggregate pointer types. There already exist enough of them to write workarounds for the missing functionality, but I think these should be builtin so we don't have to resort to such hacks to get a basic feature. What I think would good to add is:
1) "get-pointer" which dereferences a pointer to a pointer, thus returning the address its argument points to.
2) An integer constant which is equal to "sizeof(void *)" for the platform the interpreter is running on.
3) "get-short" which dereferences a pointer to a short int, thus returning the 16 bit integer its argument points to.
4) An unsigned variant of all the functions that currently dereference a pointer to a signed integer.
These all add features which I think are essential to having the ability to interface with more C libraries. I also noticed the interface only has a function for derefencing double-precision floating point. While I don't often see floating point used, especially pointers to floating point, I would think for completeness that there should also be functions to handle pointers to "float" and "long double". Thank you.
1) "get-pointer" which dereferences a pointer to a pointer, thus returning the address its argument points to.
2) An integer constant which is equal to "sizeof(void *)" for the platform the interpreter is running on.
3) "get-short" which dereferences a pointer to a short int, thus returning the 16 bit integer its argument points to.
4) An unsigned variant of all the functions that currently dereference a pointer to a signed integer.
These all add features which I think are essential to having the ability to interface with more C libraries. I also noticed the interface only has a function for derefencing double-precision floating point. While I don't often see floating point used, especially pointers to floating point, I would think for completeness that there should also be functions to handle pointers to "float" and "long double". Thank you.