RawPointer

RawPointer[addr,type]

represents a raw pointer to the specified type at the memory address addr.

Details

Examples

open allclose all

Basic Examples  (1)

Export a string as raw memory represented by a managed RawPointer:

Unmanage the pointer:

Write a value to the raw memory:

Import the raw memory as a string:

Free the raw memory:

Scope  (1)

Information  (1)

Create a pointer to raw memory:

Get Information about the pointer:

Get the memory address of the pointer:

Get the type of the pointer:

Properties & Relations  (5)

Functions like RawMemoryAllocate return a memory-managed RawPointer:

Call UnmanageObject to take ownership of the managed pointer:

Notice that the memory management of the pointer allocated is no longer active:

Unmanaged pointers should be freed with RawMemoryFree to avoid memory leaks:

NullRawPointerQ returns True if a raw pointer has 0 as its address:

Allocate some raw memory:

Convert a RawPointer into an OpaqueRawPointer:

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:

Call the function by passing the buffer and its length:

Import the raw memory as a list with RawMemoryImport:

Possible Issues  (1)

RawPointer returns a Failure for invalid memory addresses:

Wolfram Research (2023), RawPointer, Wolfram Language function, https://reference.wolfram.com/language/ref/RawPointer.html.

Text

Wolfram Research (2023), RawPointer, Wolfram Language function, https://reference.wolfram.com/language/ref/RawPointer.html.

CMS

Wolfram Language. 2023. "RawPointer." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RawPointer.html.

APA

Wolfram Language. (2023). RawPointer. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RawPointer.html

BibTeX

@misc{reference.wolfram_2024_rawpointer, author="Wolfram Research", title="{RawPointer}", year="2023", howpublished="\url{https://reference.wolfram.com/language/ref/RawPointer.html}", note=[Accessed: 22-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_rawpointer, organization={Wolfram Research}, title={RawPointer}, year={2023}, url={https://reference.wolfram.com/language/ref/RawPointer.html}, note=[Accessed: 22-November-2024 ]}