ホーム › Networking.WinSock › WSACleanup
WSACleanup
関数Winsock DLLの利用を終了し資源を解放する。
シグネチャ
// WS2_32.dll
#include <windows.h>
INT WSACleanup(void);パラメーターなし。戻り値: INT
各言語での呼び出し定義
// WS2_32.dll
#include <windows.h>
INT WSACleanup(void);[DllImport("WS2_32.dll", SetLastError = true, ExactSpelling = true)]
static extern int WSACleanup();<DllImport("WS2_32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function WSACleanup() As Integer
End FunctionDeclare PtrSafe Function WSACleanup Lib "ws2_32" () As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WSACleanup = ctypes.windll.ws2_32.WSACleanup
WSACleanup.restype = ctypes.c_int
WSACleanup.argtypes = []
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WS2_32.dll')
WSACleanup = Fiddle::Function.new(
lib['WSACleanup'],
[],
Fiddle::TYPE_INT)#[link(name = "ws2_32")]
extern "system" {
fn WSACleanup() -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("WS2_32.dll", SetLastError = true)]
public static extern int WSACleanup();
"@
$api = Add-Type -MemberDefinition $sig -Name 'WS2_32_WSACleanup' -Namespace Win32 -PassThru
# $api::WSACleanup()#uselib "WS2_32.dll"
#func global WSACleanup "WSACleanup"
; WSACleanup ; 戻り値は stat
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "WS2_32.dll"
#cfunc global WSACleanup "WSACleanup"
; res = WSACleanup(); INT WSACleanup()
#uselib "WS2_32.dll"
#cfunc global WSACleanup "WSACleanup"
; res = WSACleanup()import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ws2_32 = windows.NewLazySystemDLL("WS2_32.dll")
procWSACleanup = ws2_32.NewProc("WSACleanup")
)
r1, _, err := procWSACleanup.Call()
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction WSACleanup: Integer; stdcall;
external 'WS2_32.dll' name 'WSACleanup';result := DllCall("WS2_32\WSACleanup", "Int")●WSACleanup() = DLL("WS2_32.dll", "int WSACleanup()")
# 呼び出し: WSACleanup()
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。