forked from dotnet/fsharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnativeptr.fsi
More file actions
83 lines (71 loc) · 4.04 KB
/
Copy pathnativeptr.fsi
File metadata and controls
83 lines (71 loc) · 4.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.FSharp.NativeInterop
open Microsoft.FSharp.Core
open Microsoft.FSharp.Collections
[<RequireQualifiedAccess>]
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
/// <summary>Contains operations on native pointers. Use of these operators may
/// result in the generation of unverifiable code.</summary>
module NativePtr =
[<Unverifiable>]
[<NoDynamicInvocation>]
[<CompiledName("OfNativeIntInlined")>]
/// <summary>Returns a typed native pointer for a given machine address.</summary>
/// <param name="address">The pointer address.</param>
/// <returns>A typed pointer.</returns>
val inline ofNativeInt : address:nativeint -> nativeptr<'T>
[<Unverifiable>]
[<NoDynamicInvocation>]
[<CompiledName("ToNativeIntInlined")>]
/// <summary>Returns a machine address for a given typed native pointer.</summary>
/// <param name="address">The input pointer.</param>
/// <returns>The machine address.</returns>
val inline toNativeInt : address:nativeptr<'T> -> nativeint
[<Unverifiable>]
[<NoDynamicInvocation>]
[<CompiledName("AddPointerInlined")>]
/// <summary>Returns a typed native pointer by adding index * sizeof<'T> to the
/// given input pointer.</summary>
/// <param name="address">The input pointer.</param>
/// <param name="index">The index by which to offset the pointer.</param>
/// <returns>A typed pointer.</returns>
val inline add : address:nativeptr<'T> -> index:int -> nativeptr<'T>
[<Unverifiable>]
[<NoDynamicInvocation>]
[<CompiledName("GetPointerInlined")>]
/// <summary>Dereferences the typed native pointer computed by adding index * sizeof<'T> to the
/// given input pointer.</summary>
/// <param name="address">The input pointer.</param>
/// <param name="index">The index by which to offset the pointer.</param>
/// <returns>The value at the pointer address.</returns>
val inline get : address:nativeptr<'T> -> index:int -> 'T
[<Unverifiable>]
[<NoDynamicInvocation>]
[<CompiledName("ReadPointerInlined")>]
/// <summary>Dereferences the given typed native pointer.</summary>
/// <param name="address">The input pointer.</param>
/// <returns>The value at the pointer address.</returns>
val inline read : address:nativeptr<'T> -> 'T
[<Unverifiable>]
[<NoDynamicInvocation>]
[<CompiledName("WritePointerInlined")>]
/// <summary>Assigns the <c>value</c> into the memory location referenced by the given typed native pointer.</summary>
/// <param name="address">The input pointer.</param>
/// <param name="value">The value to assign.</param>
val inline write : address:nativeptr<'T> -> value:'T -> unit
[<Unverifiable>]
[<NoDynamicInvocation>]
[<CompiledName("SetPointerInlined")>]
/// <summary>Assigns the <c>value</c> into the memory location referenced by the typed native
/// pointer computed by adding index * sizeof<'T> to the given input pointer.</summary>
/// <param name="address">The input pointer.</param>
/// <param name="index">The index by which to offset the pointer.</param>
/// <param name="value">The value to assign.</param>
val inline set : address:nativeptr<'T> -> index:int -> value:'T -> unit
/// <summary>Allocates a region of memory on the stack.</summary>
/// <param name="count">The number of objects of type T to allocate.</param>
/// <returns>A typed pointer to the allocated memory.</returns>
[<Unverifiable>]
[<NoDynamicInvocation>]
[<CompiledName("StackAllocate")>]
val inline stackalloc : count:int -> nativeptr<'T>