ホーム › Globalization › ucol_open
ucol_open
関数指定ロケールの照合(コレータ)オブジェクトを開く。
シグネチャ
// icuin.dll
#include <windows.h>
UCollator* ucol_open(
LPCSTR loc,
UErrorCode* status
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| loc | LPCSTR | in |
| status | UErrorCode* | inout |
戻り値の型: UCollator*
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
UCollator* ucol_open(
LPCSTR loc,
UErrorCode* status
);[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr ucol_open(
[MarshalAs(UnmanagedType.LPStr)] string loc, // LPCSTR
ref int status // UErrorCode* in/out
);<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ucol_open(
<MarshalAs(UnmanagedType.LPStr)> loc As String, ' LPCSTR
ByRef status As Integer ' UErrorCode* in/out
) As IntPtr
End Function' loc : LPCSTR
' status : UErrorCode* in/out
Declare PtrSafe Function ucol_open Lib "icuin" ( _
ByVal loc As String, _
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_open = ctypes.cdll.icuin.ucol_open
ucol_open.restype = ctypes.c_void_p
ucol_open.argtypes = [
wintypes.LPCSTR, # loc : LPCSTR
ctypes.c_void_p, # status : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuin.dll')
ucol_open = Fiddle::Function.new(
lib['ucol_open'],
[
Fiddle::TYPE_VOIDP, # loc : LPCSTR
Fiddle::TYPE_VOIDP, # status : UErrorCode* in/out
],
Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)#[link(name = "icuin")]
extern "C" {
fn ucol_open(
loc: *const u8, // LPCSTR
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_open([MarshalAs(UnmanagedType.LPStr)] string loc, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_ucol_open' -Namespace Win32 -PassThru
# $api::ucol_open(loc, status)#uselib "icuin.dll"
#func global ucol_open "ucol_open" sptr, sptr
; ucol_open loc, status ; 戻り値は stat
; loc : LPCSTR -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "icuin.dll"
#cfunc global ucol_open "ucol_open" str, int
; res = ucol_open(loc, status)
; loc : LPCSTR -> "str"
; status : UErrorCode* in/out -> "int"; UCollator* ucol_open(LPCSTR loc, UErrorCode* status)
#uselib "icuin.dll"
#cfunc global ucol_open "ucol_open" str, int
; res = ucol_open(loc, status)
; loc : LPCSTR -> "str"
; status : UErrorCode* in/out -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuin = windows.NewLazySystemDLL("icuin.dll")
procucol_open = icuin.NewProc("ucol_open")
)
// loc (LPCSTR), status (UErrorCode* in/out)
r1, _, err := procucol_open.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(loc))),
uintptr(status),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // UCollator*function ucol_open(
loc: PAnsiChar; // LPCSTR
status: Pointer // UErrorCode* in/out
): Pointer; cdecl;
external 'icuin.dll' name 'ucol_open';result := DllCall("icuin\ucol_open"
, "AStr", loc ; LPCSTR
, "Ptr", status ; UErrorCode* in/out
, "Cdecl Ptr") ; return: UCollator*●ucol_open(loc, status) = DLL("icuin.dll", "void* ucol_open(char*, void*)")
# 呼び出し: ucol_open(loc, status)
# loc : LPCSTR -> "char*"
# status : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。