represents a raw pointer to the specified type at the memory address addr.
- RawPointer is returned by functions such as ForeignFunction, RawMemoryAllocate, etc.
- Functions that allocate raw memory will return a memory-managed pointer.
- OpaqueRawPointer can be used to represent untyped pointers.
- RawPointer[ptr,type] can be used to cast a pointer to a typed pointer.
- Properties of a RawPointer can be extracted with RawPointer[…][prop].
- Supported values of prop include:
"Address" memory address "Type" referenced type
Examplesopen allclose all
Basic Examples (1)
Export a string as raw memory represented by a managed RawPointer:
Get Information about the pointer:
Properties & Relations (5)
Call UnmanageObject to take ownership of the managed pointer:
Unmanaged pointers should be freed with RawMemoryFree to avoid memory leaks:
Convert the opaque raw pointer back to a RawPointer:
Allocate a raw memory for an object of type "UnsignedInteger8":
Write a value to the raw memory by passing the pointer to RawMemoryWrite:
Read the raw memory with RawMemoryRead:
Allocate a buffer of 10 "CLong" objects:
Use ForeignFunctionLoad to load a function that populates this buffer:
Import the raw memory as a list with RawMemoryImport:
Wolfram Research (2023), RawPointer, Wolfram Language function, https://reference.wolfram.com/language/ref/RawPointer.html.
Wolfram Language. 2023. "RawPointer." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RawPointer.html.
Wolfram Language. (2023). RawPointer. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RawPointer.html