質問編集履歴
1
変数名変更
title
CHANGED
File without changes
|
body
CHANGED
@@ -12,32 +12,32 @@
|
|
12
12
|
var2 = (XW)(void *)var1;
|
13
13
|
}
|
14
14
|
|
15
|
-
void TEST::
|
15
|
+
void TEST::SetPtr(IntPtr WPtrP)
|
16
16
|
{
|
17
|
-
StructTest
|
17
|
+
StructTest P;
|
18
|
-
|
18
|
+
P.a = 1;
|
19
|
-
|
19
|
+
P.b = 2;
|
20
|
-
|
20
|
+
P.c = 3;
|
21
21
|
|
22
|
-
|
22
|
+
WPtrP = (IntPtr)&P;
|
23
23
|
}
|
24
24
|
|
25
|
-
void TEST::
|
25
|
+
void TEST::ChkPtr(IntPtr WPtrP)
|
26
26
|
{
|
27
|
-
StructTest*
|
27
|
+
StructTest* P;
|
28
|
-
SetTempPtrToPointer(
|
28
|
+
SetTempPtrToPointer(WPtrP, P);
|
29
29
|
|
30
|
-
int ia =
|
30
|
+
int ia = P->a;
|
31
|
-
int ib =
|
31
|
+
int ib = P->b;
|
32
|
-
int ic =
|
32
|
+
int ic = P->c;
|
33
33
|
}
|
34
34
|
|
35
35
|
```
|
36
36
|
```C#
|
37
37
|
|
38
38
|
IntPtr WIntPtrTest = System.Runtime.InteropServices.Marshal.AllocHGlobal(System.Runtime.InteropServices.Marshal.SizeOf(8));
|
39
|
-
TEST.
|
39
|
+
TEST.SetPtr(WIntPtrTest);
|
40
|
-
TEST.
|
40
|
+
TEST.ChkPtr(WIntPtrTest);
|
41
41
|
|
42
42
|
```
|
43
43
|
|