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

utrans_getUnicodeID

関数
トランスリテレータのID文字列を取得する。
DLLicuin.dll呼出規約cdecl

シグネチャ

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

WORD* utrans_getUnicodeID(
    const void** trans,
    INT* resultLength
);

パラメーター

名前方向説明
transvoid**in対象のトランスリテレータハンドルへのポインター。
resultLengthINT*inout返されるID文字列の長さ(コード単位数)を受け取る出力ポインター。NULL可。

戻り値の型: WORD*

各言語での呼び出し定義

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

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

utrans_getUnicodeID = ctypes.cdll.icuin.utrans_getUnicodeID
utrans_getUnicodeID.restype = ctypes.c_void_p
utrans_getUnicodeID.argtypes = [
    ctypes.c_void_p,  # trans : void**
    ctypes.POINTER(ctypes.c_int),  # resultLength : INT* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procutrans_getUnicodeID = icuin.NewProc("utrans_getUnicodeID")
)

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

extern "icuin" fn utrans_getUnicodeID(
    trans: ?*anyopaque, // void**
    resultLength: [*c]i32 // INT* in/out
) callconv(.c) [*c]u16;
proc utrans_getUnicodeID(
    trans: pointer,  # void**
    resultLength: ptr int32  # INT* in/out
): ptr uint16 {.importc: "utrans_getUnicodeID", cdecl, dynlib: "icuin.dll".}
pragma(lib, "icuin");
extern(C)
ushort* utrans_getUnicodeID(
    void** trans,   // void**
    int* resultLength   // INT* in/out
);
ccall((:utrans_getUnicodeID, "icuin.dll"), Ptr{UInt16},
      (Ptr{Cvoid}, Ptr{Int32}),
      trans, resultLength)
# trans : void** -> Ptr{Cvoid}
# resultLength : INT* in/out -> Ptr{Int32}
local ffi = require("ffi")
ffi.cdef[[
uint16_t* utrans_getUnicodeID(
    void** trans,
    int32_t* resultLength);
]]
local icuin = ffi.load("icuin")
-- icuin.utrans_getUnicodeID(trans, resultLength)
-- trans : void**
-- resultLength : INT* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('icuin.dll');
const utrans_getUnicodeID = lib.func('__cdecl', 'utrans_getUnicodeID', 'uint16_t *', ['void *', 'int32_t *']);
// utrans_getUnicodeID(trans, resultLength)
// trans : void** -> 'void *'
// resultLength : INT* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("icuin.dll", {
  utrans_getUnicodeID: { parameters: ["pointer", "pointer"], result: "pointer" },
});
// lib.symbols.utrans_getUnicodeID(trans, resultLength)
// trans : void** -> "pointer"
// resultLength : INT* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint16_t* utrans_getUnicodeID(
    void** trans,
    int32_t* resultLength);
C, "icuin.dll");
// $ffi->utrans_getUnicodeID(trans, resultLength);
// trans : void**
// resultLength : INT* in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Icuin extends Library {
    Icuin INSTANCE = Native.load("icuin", Icuin.class);
    Pointer utrans_getUnicodeID(
        Pointer trans,   // void**
        IntByReference resultLength   // INT* in/out
    );
}
@[Link("icuin")]
lib Libicuin
  fun utrans_getUnicodeID = utrans_getUnicodeID(
    trans : Void**,   # void**
    resultLength : Int32*   # INT* in/out
  ) : UInt16*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef utrans_getUnicodeIDNative = Pointer<Uint16> Function(Pointer<Void>, Pointer<Int32>);
typedef utrans_getUnicodeIDDart = Pointer<Uint16> Function(Pointer<Void>, Pointer<Int32>);
final utrans_getUnicodeID = DynamicLibrary.open('icuin.dll')
    .lookupFunction<utrans_getUnicodeIDNative, utrans_getUnicodeIDDart>('utrans_getUnicodeID');
// trans : void** -> Pointer<Void>
// resultLength : INT* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function utrans_getUnicodeID(
  trans: Pointer;   // void**
  resultLength: Pointer   // INT* in/out
): Pointer; cdecl;
  external 'icuin.dll' name 'utrans_getUnicodeID';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "utrans_getUnicodeID"
  c_utrans_getUnicodeID :: Ptr () -> Ptr Int32 -> IO (Ptr Word16)
-- trans : void** -> Ptr ()
-- resultLength : INT* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let utrans_getunicodeid =
  foreign "utrans_getUnicodeID"
    ((ptr void) @-> (ptr int32_t) @-> returning (ptr uint16_t))
(* trans : void** -> (ptr void) *)
(* resultLength : INT* in/out -> (ptr int32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library icuin (t "icuin.dll"))
(cffi:use-foreign-library icuin)

(cffi:defcfun ("utrans_getUnicodeID" utrans-get-unicode-id :convention :cdecl) :pointer
  (trans :pointer)   ; void**
  (result-length :pointer))   ; INT* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $utrans_getUnicodeID = Win32::API::More->new('icuin',
    'LPVOID utrans_getUnicodeID(LPVOID trans, LPVOID resultLength)');
# my $ret = $utrans_getUnicodeID->Call($trans, $resultLength);
# trans : void** -> LPVOID
# resultLength : INT* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。