-
Notifications
You must be signed in to change notification settings - Fork 35
/
Pointers.vb
96 lines (76 loc) · 3.25 KB
/
Pointers.vb
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
84
85
86
87
88
89
90
91
92
93
94
95
96
#Region "Microsoft.VisualBasic::f13ea8556ad8d7833dfbd328e3818857, ..\sciBASIC#\Microsoft.VisualBasic.Architecture.Framework\Extensions\Reflection\Marshal\Pointers.vb"
' Author:
'
' asuka ([email protected])
' xieguigang ([email protected])
' xie ([email protected])
'
' Copyright (c) 2016 GPL3 Licensed
'
'
' GNU GENERAL PUBLIC LICENSE (GPL3)
'
' This program is free software: you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation, either version 3 of the License, or
' (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' GNU General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program. If not, see <http://www.gnu.org/licenses/>.
#End Region
Imports System.Runtime.InteropServices.Marshal
Namespace Emit.Marshal
Public Class [Integer] : Inherits IntPtr(Of Integer)
Sub New(p As System.IntPtr, chunkSize As Integer)
Call MyBase.New(p, chunkSize, AddressOf Copy, AddressOf Copy)
End Sub
End Class
Public Class [Char] : Inherits IntPtr(Of Char)
Sub New(p As System.IntPtr, chunkSize As Integer)
Call MyBase.New(p, chunkSize, AddressOf Copy, AddressOf Copy)
End Sub
End Class
Public Class [Short] : Inherits IntPtr(Of Short)
Sub New(p As System.IntPtr, chunkSize As Integer)
Call MyBase.New(p, chunkSize, AddressOf Copy, AddressOf Copy)
End Sub
End Class
Public Class [Long] : Inherits IntPtr(Of Long)
Sub New(p As System.IntPtr, chunkSize As Integer)
Call MyBase.New(p, chunkSize, AddressOf Copy, AddressOf Copy)
End Sub
End Class
Public Class [Single] : Inherits IntPtr(Of Single)
Sub New(p As System.IntPtr, chunkSize As Integer)
Call MyBase.New(p, chunkSize, AddressOf Copy, AddressOf Copy)
End Sub
End Class
''' <summary>
''' Represents a pointer to an 8-bit unsigned integer array.
''' </summary>
Public Class [Byte] : Inherits IntPtr(Of Byte)
''' <summary>
''' Represents a pointer to an 8-bit unsigned integer array.
''' </summary>
''' <param name="p">The start address location of the array in the memory</param>
''' <param name="chunkSize">array length</param>
Sub New(p As System.IntPtr, chunkSize As Integer)
Call MyBase.New(p, chunkSize, AddressOf Copy, AddressOf Copy)
End Sub
End Class
Public Class [IntPtr] : Inherits IntPtr(Of System.IntPtr)
Sub New(p As System.IntPtr, chunkSize As Integer)
Call MyBase.New(p, chunkSize, AddressOf Copy, AddressOf Copy)
End Sub
End Class
Public Class [Double] : Inherits IntPtr(Of Double)
Sub New(p As System.IntPtr, chunkSize As Integer)
Call MyBase.New(p, chunkSize, AddressOf Copy, AddressOf Copy)
End Sub
End Class
End Namespace