ホーム › NetworkManagement.Dns › DnsFree
DnsFree
関数DNS APIが割り当てたメモリを解放する。
シグネチャ
// DNSAPI.dll
#include <windows.h>
void DnsFree(
void* pData, // optional
DNS_FREE_TYPE FreeType
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pData | void* | inoptional |
| FreeType | DNS_FREE_TYPE | in |
戻り値の型: void
各言語での呼び出し定義
// DNSAPI.dll
#include <windows.h>
void DnsFree(
void* pData, // optional
DNS_FREE_TYPE FreeType
);[DllImport("DNSAPI.dll", ExactSpelling = true)]
static extern void DnsFree(
IntPtr pData, // void* optional
int FreeType // DNS_FREE_TYPE
);<DllImport("DNSAPI.dll", ExactSpelling:=True)>
Public Shared Sub DnsFree(
pData As IntPtr, ' void* optional
FreeType As Integer ' DNS_FREE_TYPE
)
End Sub' pData : void* optional
' FreeType : DNS_FREE_TYPE
Declare PtrSafe Sub DnsFree Lib "dnsapi" ( _
ByVal pData As LongPtr, _
ByVal FreeType As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DnsFree = ctypes.windll.dnsapi.DnsFree
DnsFree.restype = None
DnsFree.argtypes = [
ctypes.POINTER(None), # pData : void* optional
ctypes.c_int, # FreeType : DNS_FREE_TYPE
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('DNSAPI.dll')
DnsFree = Fiddle::Function.new(
lib['DnsFree'],
[
Fiddle::TYPE_VOIDP, # pData : void* optional
Fiddle::TYPE_INT, # FreeType : DNS_FREE_TYPE
],
Fiddle::TYPE_VOID)#[link(name = "dnsapi")]
extern "system" {
fn DnsFree(
pData: *mut (), // void* optional
FreeType: i32 // DNS_FREE_TYPE
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("DNSAPI.dll")]
public static extern void DnsFree(IntPtr pData, int FreeType);
"@
$api = Add-Type -MemberDefinition $sig -Name 'DNSAPI_DnsFree' -Namespace Win32 -PassThru
# $api::DnsFree(pData, FreeType)#uselib "DNSAPI.dll"
#func global DnsFree "DnsFree" sptr, sptr
; DnsFree pData, FreeType
; pData : void* optional -> "sptr"
; FreeType : DNS_FREE_TYPE -> "sptr"#uselib "DNSAPI.dll"
#func global DnsFree "DnsFree" sptr, int
; DnsFree pData, FreeType
; pData : void* optional -> "sptr"
; FreeType : DNS_FREE_TYPE -> "int"; void DnsFree(void* pData, DNS_FREE_TYPE FreeType)
#uselib "DNSAPI.dll"
#func global DnsFree "DnsFree" intptr, int
; DnsFree pData, FreeType
; pData : void* optional -> "intptr"
; FreeType : DNS_FREE_TYPE -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
dnsapi = windows.NewLazySystemDLL("DNSAPI.dll")
procDnsFree = dnsapi.NewProc("DnsFree")
)
// pData (void* optional), FreeType (DNS_FREE_TYPE)
r1, _, err := procDnsFree.Call(
uintptr(pData),
uintptr(FreeType),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure DnsFree(
pData: Pointer; // void* optional
FreeType: Integer // DNS_FREE_TYPE
); stdcall;
external 'DNSAPI.dll' name 'DnsFree';result := DllCall("DNSAPI\DnsFree"
, "Ptr", pData ; void* optional
, "Int", FreeType ; DNS_FREE_TYPE
, "Int") ; return: void●DnsFree(pData, FreeType) = DLL("DNSAPI.dll", "int DnsFree(void*, int)")
# 呼び出し: DnsFree(pData, FreeType)
# pData : void* optional -> "void*"
# FreeType : DNS_FREE_TYPE -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。