Home
Insert
Update snippet 'Modify the value at given memory address by F#'
Title
Description
It's not easy for F# programmer to deal with the unsafe code, here I tried to provide a small code snippet to demonstrate the issue.
Source code
//Memory Address,you may get this address from some other operations //not sure if this is readable safe address let p = 0x002100000n //Pointer to the Address let address : nativeptr<int32> = Microsoft.FSharp.NativeInterop.NativePtr.ofNativeInt(p) //set the value which is stored in the memory with given address and offset to 0xA let setV = Microsoft.FSharp.NativeInterop.NativePtr.set(address) 0 0xA //get the changed value let result = Microsoft.FSharp.NativeInterop.NativePtr.read(address)
Tags
memory address;f#
memory address;f#
Author
Link
Reference NuGet packages
If your snippet has external dependencies, enter the names of NuGet packages to reference, separated by a comma (
#r
directives are not required).
Update