ホーム › Globalization › ucol_keyHashCode
ucol_keyHashCode
関数照合ソートキーのハッシュコードを計算する。
シグネチャ
// icuin.dll
#include <windows.h>
INT ucol_keyHashCode(
const BYTE* key,
INT length
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| key | BYTE* | in |
| length | INT | in |
戻り値の型: INT
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
INT ucol_keyHashCode(
const BYTE* key,
INT length
);[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int ucol_keyHashCode(
IntPtr key, // BYTE*
int length // INT
);<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ucol_keyHashCode(
key As IntPtr, ' BYTE*
length As Integer ' INT
) As Integer
End Function' key : BYTE*
' length : INT
Declare PtrSafe Function ucol_keyHashCode Lib "icuin" ( _
ByVal key As LongPtr, _
ByVal length As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ucol_keyHashCode = ctypes.cdll.icuin.ucol_keyHashCode
ucol_keyHashCode.restype = ctypes.c_int
ucol_keyHashCode.argtypes = [
ctypes.POINTER(ctypes.c_ubyte), # key : BYTE*
ctypes.c_int, # length : INT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuin.dll')
ucol_keyHashCode = Fiddle::Function.new(
lib['ucol_keyHashCode'],
[
Fiddle::TYPE_VOIDP, # key : BYTE*
Fiddle::TYPE_INT, # length : INT
],
Fiddle::TYPE_INT, Fiddle::Function::CDECL)#[link(name = "icuin")]
extern "C" {
fn ucol_keyHashCode(
key: *const u8, // BYTE*
length: i32 // INT
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int ucol_keyHashCode(IntPtr key, int length);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_ucol_keyHashCode' -Namespace Win32 -PassThru
# $api::ucol_keyHashCode(key, length)#uselib "icuin.dll"
#func global ucol_keyHashCode "ucol_keyHashCode" sptr, sptr
; ucol_keyHashCode varptr(key), length ; 戻り値は stat
; key : BYTE* -> "sptr"
; length : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuin.dll" #cfunc global ucol_keyHashCode "ucol_keyHashCode" var, int ; res = ucol_keyHashCode(key, length) ; key : BYTE* -> "var" ; length : INT -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuin.dll" #cfunc global ucol_keyHashCode "ucol_keyHashCode" sptr, int ; res = ucol_keyHashCode(varptr(key), length) ; key : BYTE* -> "sptr" ; length : INT -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT ucol_keyHashCode(BYTE* key, INT length) #uselib "icuin.dll" #cfunc global ucol_keyHashCode "ucol_keyHashCode" var, int ; res = ucol_keyHashCode(key, length) ; key : BYTE* -> "var" ; length : INT -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT ucol_keyHashCode(BYTE* key, INT length) #uselib "icuin.dll" #cfunc global ucol_keyHashCode "ucol_keyHashCode" intptr, int ; res = ucol_keyHashCode(varptr(key), length) ; key : BYTE* -> "intptr" ; length : INT -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuin = windows.NewLazySystemDLL("icuin.dll")
procucol_keyHashCode = icuin.NewProc("ucol_keyHashCode")
)
// key (BYTE*), length (INT)
r1, _, err := procucol_keyHashCode.Call(
uintptr(key),
uintptr(length),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction ucol_keyHashCode(
key: Pointer; // BYTE*
length: Integer // INT
): Integer; cdecl;
external 'icuin.dll' name 'ucol_keyHashCode';result := DllCall("icuin\ucol_keyHashCode"
, "Ptr", key ; BYTE*
, "Int", length ; INT
, "Cdecl Int") ; return: INT●ucol_keyHashCode(key, length) = DLL("icuin.dll", "int ucol_keyHashCode(void*, int)")
# 呼び出し: ucol_keyHashCode(key, length)
# key : BYTE* -> "void*"
# length : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。