ホーム › System.Threading › TlsFree
TlsFree
関数確保したTLSインデックスを解放する。
シグネチャ
// KERNEL32.dll
#include <windows.h>
BOOL TlsFree(
DWORD dwTlsIndex
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| dwTlsIndex | DWORD | in |
戻り値の型: BOOL
各言語での呼び出し定義
// KERNEL32.dll
#include <windows.h>
BOOL TlsFree(
DWORD dwTlsIndex
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool TlsFree(
uint dwTlsIndex // DWORD
);<DllImport("KERNEL32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function TlsFree(
dwTlsIndex As UInteger ' DWORD
) As Boolean
End Function' dwTlsIndex : DWORD
Declare PtrSafe Function TlsFree Lib "kernel32" ( _
ByVal dwTlsIndex As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
TlsFree = ctypes.windll.kernel32.TlsFree
TlsFree.restype = wintypes.BOOL
TlsFree.argtypes = [
wintypes.DWORD, # dwTlsIndex : DWORD
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
TlsFree = Fiddle::Function.new(
lib['TlsFree'],
[
-Fiddle::TYPE_INT, # dwTlsIndex : DWORD
],
Fiddle::TYPE_INT)#[link(name = "kernel32")]
extern "system" {
fn TlsFree(
dwTlsIndex: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", SetLastError = true)]
public static extern bool TlsFree(uint dwTlsIndex);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_TlsFree' -Namespace Win32 -PassThru
# $api::TlsFree(dwTlsIndex)#uselib "KERNEL32.dll"
#func global TlsFree "TlsFree" sptr
; TlsFree dwTlsIndex ; 戻り値は stat
; dwTlsIndex : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "KERNEL32.dll"
#cfunc global TlsFree "TlsFree" int
; res = TlsFree(dwTlsIndex)
; dwTlsIndex : DWORD -> "int"; BOOL TlsFree(DWORD dwTlsIndex)
#uselib "KERNEL32.dll"
#cfunc global TlsFree "TlsFree" int
; res = TlsFree(dwTlsIndex)
; dwTlsIndex : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procTlsFree = kernel32.NewProc("TlsFree")
)
// dwTlsIndex (DWORD)
r1, _, err := procTlsFree.Call(
uintptr(dwTlsIndex),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction TlsFree(
dwTlsIndex: DWORD // DWORD
): BOOL; stdcall;
external 'KERNEL32.dll' name 'TlsFree';result := DllCall("KERNEL32\TlsFree"
, "UInt", dwTlsIndex ; DWORD
, "Int") ; return: BOOL●TlsFree(dwTlsIndex) = DLL("KERNEL32.dll", "bool TlsFree(dword)")
# 呼び出し: TlsFree(dwTlsIndex)
# dwTlsIndex : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。