03-07-2005, 01:53 AM
I have an existing sub of the form:
I would like to move this function out to a C library without changing any of the code apart from the declare. Am I right in assuming that this is not possible with arrays? From my testing, every other type seems to work (strings and integers can be passed ByVal, UDFs seem to be passed as pointers), but not arrays. The only current option seems to be to pass a pointer to the first element, which would mean changing all of the calling code.
Is there nothing I can do, at the point of declaration (like a ByVal), which would take an array() and turn it into something I can use in C?
If there is not, can I suggest that ByVal is implemented for arrays in a similar way to Strings? So that using:
...would pass a pointer to the first element instead of just giving an error?
Code:
declare sub myfunc (buf() as integer)
I would like to move this function out to a C library without changing any of the code apart from the declare. Am I right in assuming that this is not possible with arrays? From my testing, every other type seems to work (strings and integers can be passed ByVal, UDFs seem to be passed as pointers), but not arrays. The only current option seems to be to pass a pointer to the first element, which would mean changing all of the calling code.
Is there nothing I can do, at the point of declaration (like a ByVal), which would take an array() and turn it into something I can use in C?
If there is not, can I suggest that ByVal is implemented for arrays in a similar way to Strings? So that using:
Code:
declare sub myfunc cdecl alias "myfunc" (byval buf() as integer)
...would pass a pointer to the first element instead of just giving an error?