Win32 API 日本語リファレンス
ホームNetworkManagement.Snmp › SnmpFreeContext

SnmpFreeContext

関数
WinSNMPコンテキストに割り当てたリソースを解放する。
DLLwsnmp32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// wsnmp32.dll
#include <windows.h>

DWORD SnmpFreeContext(
    INT_PTR context
);

パラメーター

名前方向
contextINT_PTRin

戻り値の型: DWORD

各言語での呼び出し定義

// wsnmp32.dll
#include <windows.h>

DWORD SnmpFreeContext(
    INT_PTR context
);
[DllImport("wsnmp32.dll", ExactSpelling = true)]
static extern uint SnmpFreeContext(
    IntPtr context   // INT_PTR
);
<DllImport("wsnmp32.dll", ExactSpelling:=True)>
Public Shared Function SnmpFreeContext(
    context As IntPtr   ' INT_PTR
) As UInteger
End Function
' context : INT_PTR
Declare PtrSafe Function SnmpFreeContext Lib "wsnmp32" ( _
    ByVal context As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SnmpFreeContext = ctypes.windll.wsnmp32.SnmpFreeContext
SnmpFreeContext.restype = wintypes.DWORD
SnmpFreeContext.argtypes = [
    ctypes.c_ssize_t,  # context : INT_PTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('wsnmp32.dll')
SnmpFreeContext = Fiddle::Function.new(
  lib['SnmpFreeContext'],
  [
    Fiddle::TYPE_INTPTR_T,  # context : INT_PTR
  ],
  -Fiddle::TYPE_INT)
#[link(name = "wsnmp32")]
extern "system" {
    fn SnmpFreeContext(
        context: isize  // INT_PTR
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("wsnmp32.dll")]
public static extern uint SnmpFreeContext(IntPtr context);
"@
$api = Add-Type -MemberDefinition $sig -Name 'wsnmp32_SnmpFreeContext' -Namespace Win32 -PassThru
# $api::SnmpFreeContext(context)
#uselib "wsnmp32.dll"
#func global SnmpFreeContext "SnmpFreeContext" sptr
; SnmpFreeContext context   ; 戻り値は stat
; context : INT_PTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "wsnmp32.dll"
#cfunc global SnmpFreeContext "SnmpFreeContext" sptr
; res = SnmpFreeContext(context)
; context : INT_PTR -> "sptr"
; DWORD SnmpFreeContext(INT_PTR context)
#uselib "wsnmp32.dll"
#cfunc global SnmpFreeContext "SnmpFreeContext" intptr
; res = SnmpFreeContext(context)
; context : INT_PTR -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wsnmp32 = windows.NewLazySystemDLL("wsnmp32.dll")
	procSnmpFreeContext = wsnmp32.NewProc("SnmpFreeContext")
)

// context (INT_PTR)
r1, _, err := procSnmpFreeContext.Call(
	uintptr(context),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function SnmpFreeContext(
  context: NativeInt   // INT_PTR
): DWORD; stdcall;
  external 'wsnmp32.dll' name 'SnmpFreeContext';
result := DllCall("wsnmp32\SnmpFreeContext"
    , "Ptr", context   ; INT_PTR
    , "UInt")   ; return: DWORD
●SnmpFreeContext(context) = DLL("wsnmp32.dll", "dword SnmpFreeContext(int)")
# 呼び出し: SnmpFreeContext(context)
# context : INT_PTR -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。