BASIC Developer & Support Resources > Scripting Languages

IDLL

<< < (8/8)

JRS:
A back door method of PRINT s. I was testing pointers to SB strings to use with other API calls that require a pointer. SB allows embedding anything in it's strings so my GETSTR function won't work with them. (only null terminated strings) Internally SB supports zstrings but at the API level.


--- Code: ---DECLARE SUB DLL ALIAS "_idll" LIB "iDLL-Server"
DECLARE SUB VARPTR ALIAS "varptr" LIB "iDLL-Server"

FUNCTION GETMEM(mem_addr, bytes)
LOCAL tmp_ptr, tmp_data
  tmp_ptr = 0
  DLL("strncpy " & VARPTR(tmp_ptr) & " " & mem_addr & " 4")
  tmp_data = 0
  tmp_data = DLL("strncpy " & VARPTR(tmp_data) & " " & tmp_ptr & " " & bytes)
  GETMEM = tmp_data
END FUNCTION

s = "0123456789"

PRINT GETMEM(VARPTR(s),LEN(s)),"\n"

--- End code ---

jrs@Laptop:~/SB/test$ scriba gmtest.sb
0123456789
jrs@Laptop:~/SB/test$

Navigation

[0] Message Index

[*] Previous page

Go to full version