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

utext_openUChars

関数
UChar文字列に対するUTextを開く。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

UText* utext_openUChars(
    UText* ut,
    const WORD* s,
    LONGLONG length,
    UErrorCode* status
);

パラメーター

名前方向
utUText*inout
sWORD*in
lengthLONGLONGin
statusUErrorCode*inout

戻り値の型: UText*

各言語での呼び出し定義

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

UText* utext_openUChars(
    UText* ut,
    const WORD* s,
    LONGLONG length,
    UErrorCode* status
);
[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr utext_openUChars(
    IntPtr ut,   // UText* in/out
    ref ushort s,   // WORD*
    long length,   // LONGLONG
    ref int status   // UErrorCode* in/out
);
<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function utext_openUChars(
    ut As IntPtr,   ' UText* in/out
    ByRef s As UShort,   ' WORD*
    length As Long,   ' LONGLONG
    ByRef status As Integer   ' UErrorCode* in/out
) As IntPtr
End Function
' ut : UText* in/out
' s : WORD*
' length : LONGLONG
' status : UErrorCode* in/out
Declare PtrSafe Function utext_openUChars Lib "icuuc" ( _
    ByVal ut As LongPtr, _
    ByRef s As Integer, _
    ByVal length As LongLong, _
    ByRef status As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

utext_openUChars = ctypes.cdll.icuuc.utext_openUChars
utext_openUChars.restype = ctypes.c_void_p
utext_openUChars.argtypes = [
    ctypes.c_void_p,  # ut : UText* in/out
    ctypes.POINTER(ctypes.c_ushort),  # s : WORD*
    ctypes.c_longlong,  # length : LONGLONG
    ctypes.c_void_p,  # status : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
utext_openUChars = Fiddle::Function.new(
  lib['utext_openUChars'],
  [
    Fiddle::TYPE_VOIDP,  # ut : UText* in/out
    Fiddle::TYPE_VOIDP,  # s : WORD*
    Fiddle::TYPE_LONG_LONG,  # length : LONGLONG
    Fiddle::TYPE_VOIDP,  # status : UErrorCode* in/out
  ],
  Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn utext_openUChars(
        ut: *mut UText,  // UText* in/out
        s: *const u16,  // WORD*
        length: i64,  // LONGLONG
        status: *mut i32  // UErrorCode* in/out
    ) -> *mut UText;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr utext_openUChars(IntPtr ut, ref ushort s, long length, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_utext_openUChars' -Namespace Win32 -PassThru
# $api::utext_openUChars(ut, s, length, status)
#uselib "icuuc.dll"
#func global utext_openUChars "utext_openUChars" sptr, sptr, sptr, sptr
; utext_openUChars varptr(ut), varptr(s), length, status   ; 戻り値は stat
; ut : UText* in/out -> "sptr"
; s : WORD* -> "sptr"
; length : LONGLONG -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icuuc.dll"
#cfunc global utext_openUChars "utext_openUChars" var, var, int64, int
; res = utext_openUChars(ut, s, length, status)
; ut : UText* in/out -> "var"
; s : WORD* -> "var"
; length : LONGLONG -> "int64"
; status : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
出力引数:
; UText* utext_openUChars(UText* ut, WORD* s, LONGLONG length, UErrorCode* status)
#uselib "icuuc.dll"
#cfunc global utext_openUChars "utext_openUChars" var, var, int64, int
; res = utext_openUChars(ut, s, length, status)
; ut : UText* in/out -> "var"
; s : WORD* -> "var"
; length : LONGLONG -> "int64"
; status : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procutext_openUChars = icuuc.NewProc("utext_openUChars")
)

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