0クリア済みメモリブロックの割り当て
Namespace: fvalgcliAssembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)
Syntax
C# |
---|
public static IntPtr fnOAL_calloc(
SIZE_T num,
SIZE_T size
) |
Visual Basic |
---|
Public Shared Function fnOAL_calloc (
num As SIZE_T,
size As SIZE_T
) As IntPtr |
Return Value
Type:
IntPtr
正常に終了した場合は、割り当てられたメモリブロックへのポインタを返します。
メモリ不足などで、異常終了した場合には IntPtr.Zero を返します。
解放する際は
fnOAL_free(IntPtr) を使用してください。
Remarks
Examples
C# | Copy |
---|
using System;
using System.Collections.Generic;
using System.Text;
using fvalgcli;
namespace TC
{
public partial class FIE
{
[FvPluginExecute]
public void fnOAL_calloc()
{
PNT_T_PTR mem = PNT_T_PTR.Zero;
uint num = 1024;
SIZE_T size = PNT_T_PTR.SizeOfItem;
try
{
mem = api.fnOAL_calloc(num, size);
Assert.IsTrue(mem != PNT_T_PTR.Zero, "fnOAL_calloc: エラーが発生しました。");
for (int i = 0; i < size; i++)
{
Assert.IsTrue(mem[i].x == 0, "メモリーが0クリアされていません。");
Assert.IsTrue(mem[i].y == 0, "メモリーが0クリアされていません。");
}
}
finally
{
api.fnOAL_free(mem);
}
}
}
} |
Visual Basic | Copy |
---|
Imports System.Collections.Generic
Imports System.Text
Imports fvalgcli
Public Partial Class FIE
<FvPluginExecute> _
Public Sub fnOAL_calloc()
Dim mem As PNT_T_PTR = PNT_T_PTR.Zero
Dim num As UInteger = 1024
Dim size As SIZE_T = PNT_T_PTR.SizeOfItem
Try
mem = api.fnOAL_calloc(num, size)
Assert.IsTrue(mem <> PNT_T_PTR.Zero, "fnOAL_calloc: エラーが発生しました。")
Dim iloop As Integer = size.ToInt32() - 1
For i As Integer = 0 To iloop
Assert.IsTrue(mem(i).x = 0, "メモリーが0クリアされていません。")
Assert.IsTrue(mem(i).y = 0, "メモリーが0クリアされていません。")
Next
Finally
api.fnOAL_free(mem)
End Try
End Sub
End Class |
See Also