- May
- 3,515
- 5
1/ When the BUFFER keyword is used (so TCC would provide a buffer in which the function can return a string),
- is it necessary to specify the size of the buffer, or does TCC automatically provide it to the called function?
- if the buffer size must be specified in the TCC command using @WINAPI, what is the maximum size?
2/ Some APIs fill the buffer with data structured in the manner of environment variable storage, i.e., multiple individual strings, each terminated with a NUL character, with an empty string representing the end of the list. TCC users can only access the first string of the result, because its NUL terminator cuts off access. How can we access the subsequent strings? Possible methods I see:
- spread the results into an array (undoubtedly requires significant TCC enhancement)
- put the result into a binary buffer. This might be possible by passing the address and size of an already allocated binary buffer to the API, but I cannot find TCC syntax to make this possible.
BTW, the HELP lines displaying the syntax of @CAPI and of @WINAPI have an unmatched left bracket [ where the choices of parameter formats to be passed to the API are shown, the list of choices is not closed, and there is no indication of repeatability. It apparently assumes that only professional programmers will try to use these functions and their mental parsers are DWIM.
- is it necessary to specify the size of the buffer, or does TCC automatically provide it to the called function?
- if the buffer size must be specified in the TCC command using @WINAPI, what is the maximum size?
2/ Some APIs fill the buffer with data structured in the manner of environment variable storage, i.e., multiple individual strings, each terminated with a NUL character, with an empty string representing the end of the list. TCC users can only access the first string of the result, because its NUL terminator cuts off access. How can we access the subsequent strings? Possible methods I see:
- spread the results into an array (undoubtedly requires significant TCC enhancement)
- put the result into a binary buffer. This might be possible by passing the address and size of an already allocated binary buffer to the API, but I cannot find TCC syntax to make this possible.
BTW, the HELP lines displaying the syntax of @CAPI and of @WINAPI have an unmatched left bracket [ where the choices of parameter formats to be passed to the API are shown, the list of choices is not closed, and there is no indication of repeatability. It apparently assumes that only professional programmers will try to use these functions and their mental parsers are DWIM.