This doesn't do anything useful.
The problem is that Blitz does not use C-style, zero-terminated strings.
But a function in a DLL expects such a string. So what does this do?
Blitz builds a temporary C-style string containing s and appends a zero byte.
Then it calls StrPtr, passing the address of the temporary copy.
The DLL returns the passed address, i.e. a pointer to the temporary copy.
This is not the address of s. Examine the addresses displayed here.
What if a DLL function returns a string, i.e. pointer to C-style string?
When the function returns Blitz immediately builds a new basic-style string.
The problem is that Blitz does not use C-style, zero-terminated strings.
But a function in a DLL expects such a string. So what does this do?
s$ = "Now is the time" Print StrPtr(s$)
Blitz builds a temporary C-style string containing s and appends a zero byte.
Then it calls StrPtr, passing the address of the temporary copy.
The DLL returns the passed address, i.e. a pointer to the temporary copy.
This is not the address of s. Examine the addresses displayed here.
s$ = "blitz" t$ = "basic" Print StrPtr(s) Print StrPtr(t) WaitKey : End
What if a DLL function returns a string, i.e. pointer to C-style string?
When the function returns Blitz immediately builds a new basic-style string.