Win32 API 日本語リファレンス
ホームGlobalization › ucol_openBinary

ucol_openBinary

関数
バイナリデータから照合器を生成して開く。
DLLicuin.dll呼出規約cdecl

シグネチャ

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

UCollator* ucol_openBinary(
    const BYTE* bin,
    INT length,
    const UCollator* base,
    UErrorCode* status
);

パラメーター

名前方向
binBYTE*in
lengthINTin
baseUCollator*in
statusUErrorCode*inout

戻り値の型: UCollator*

各言語での呼び出し定義

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

UCollator* ucol_openBinary(
    const BYTE* bin,
    INT length,
    const UCollator* base,
    UErrorCode* status
);
[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr ucol_openBinary(
    IntPtr bin,   // BYTE*
    int length,   // INT
    ref IntPtr base,   // UCollator*
    ref int status   // UErrorCode* in/out
);
<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ucol_openBinary(
    bin As IntPtr,   ' BYTE*
    length As Integer,   ' INT
    ByRef base As IntPtr,   ' UCollator*
    ByRef status As Integer   ' UErrorCode* in/out
) As IntPtr
End Function
' bin : BYTE*
' length : INT
' base : UCollator*
' status : UErrorCode* in/out
Declare PtrSafe Function ucol_openBinary Lib "icuin" ( _
    ByVal bin As LongPtr, _
    ByVal length As Long, _
    ByRef base As LongPtr, _
    ByRef status As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ucol_openBinary = ctypes.cdll.icuin.ucol_openBinary
ucol_openBinary.restype = ctypes.c_void_p
ucol_openBinary.argtypes = [
    ctypes.POINTER(ctypes.c_ubyte),  # bin : BYTE*
    ctypes.c_int,  # length : INT
    ctypes.c_void_p,  # base : UCollator*
    ctypes.c_void_p,  # status : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuin.dll')
ucol_openBinary = Fiddle::Function.new(
  lib['ucol_openBinary'],
  [
    Fiddle::TYPE_VOIDP,  # bin : BYTE*
    Fiddle::TYPE_INT,  # length : INT
    Fiddle::TYPE_VOIDP,  # base : UCollator*
    Fiddle::TYPE_VOIDP,  # status : UErrorCode* in/out
  ],
  Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)
#[link(name = "icuin")]
extern "C" {
    fn ucol_openBinary(
        bin: *const u8,  // BYTE*
        length: i32,  // INT
        base: *const isize,  // UCollator*
        status: *mut i32  // UErrorCode* in/out
    ) -> *mut isize;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr ucol_openBinary(IntPtr bin, int length, ref IntPtr base, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_ucol_openBinary' -Namespace Win32 -PassThru
# $api::ucol_openBinary(bin, length, base, status)
#uselib "icuin.dll"
#func global ucol_openBinary "ucol_openBinary" sptr, sptr, sptr, sptr
; ucol_openBinary varptr(bin), length, base, status   ; 戻り値は stat
; bin : BYTE* -> "sptr"
; length : INT -> "sptr"
; base : UCollator* -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icuin.dll"
#cfunc global ucol_openBinary "ucol_openBinary" var, int, int, int
; res = ucol_openBinary(bin, length, base, status)
; bin : BYTE* -> "var"
; length : INT -> "int"
; base : UCollator* -> "int"
; status : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; UCollator* ucol_openBinary(BYTE* bin, INT length, UCollator* base, UErrorCode* status)
#uselib "icuin.dll"
#cfunc global ucol_openBinary "ucol_openBinary" var, int, int, int
; res = ucol_openBinary(bin, length, base, status)
; bin : BYTE* -> "var"
; length : INT -> "int"
; base : UCollator* -> "int"
; status : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procucol_openBinary = icuin.NewProc("ucol_openBinary")
)

// bin (BYTE*), length (INT), base (UCollator*), status (UErrorCode* in/out)
r1, _, err := procucol_openBinary.Call(
	uintptr(bin),
	uintptr(length),
	uintptr(base),
	uintptr(status),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // UCollator*
function ucol_openBinary(
  bin: Pointer;   // BYTE*
  length: Integer;   // INT
  base: Pointer;   // UCollator*
  status: Pointer   // UErrorCode* in/out
): Pointer; cdecl;
  external 'icuin.dll' name 'ucol_openBinary';
result := DllCall("icuin\ucol_openBinary"
    , "Ptr", bin   ; BYTE*
    , "Int", length   ; INT
    , "Ptr", base   ; UCollator*
    , "Ptr", status   ; UErrorCode* in/out
    , "Cdecl Ptr")   ; return: UCollator*
●ucol_openBinary(bin, length, base, status) = DLL("icuin.dll", "void* ucol_openBinary(void*, int, void*, void*)")
# 呼び出し: ucol_openBinary(bin, length, base, status)
# bin : BYTE* -> "void*"
# length : INT -> "int"
# base : UCollator* -> "void*"
# status : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。