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

ucnvsel_serialize

関数
コンバータ選択器をバイナリ形式に直列化する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

INT ucnvsel_serialize(
    const UConverterSelector* sel,
    void* buffer,
    INT bufferCapacity,
    UErrorCode* status
);

パラメーター

名前方向
selUConverterSelector*in
buffervoid*inout
bufferCapacityINTin
statusUErrorCode*inout

戻り値の型: INT

各言語での呼び出し定義

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

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

ucnvsel_serialize = ctypes.cdll.icuuc.ucnvsel_serialize
ucnvsel_serialize.restype = ctypes.c_int
ucnvsel_serialize.argtypes = [
    ctypes.c_void_p,  # sel : UConverterSelector*
    ctypes.POINTER(None),  # buffer : void* in/out
    ctypes.c_int,  # bufferCapacity : INT
    ctypes.c_void_p,  # status : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
ucnvsel_serialize = Fiddle::Function.new(
  lib['ucnvsel_serialize'],
  [
    Fiddle::TYPE_VOIDP,  # sel : UConverterSelector*
    Fiddle::TYPE_VOIDP,  # buffer : void* in/out
    Fiddle::TYPE_INT,  # bufferCapacity : INT
    Fiddle::TYPE_VOIDP,  # status : UErrorCode* in/out
  ],
  Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn ucnvsel_serialize(
        sel: *const isize,  // UConverterSelector*
        buffer: *mut (),  // void* in/out
        bufferCapacity: i32,  // INT
        status: *mut i32  // UErrorCode* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int ucnvsel_serialize(ref IntPtr sel, IntPtr buffer, int bufferCapacity, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_ucnvsel_serialize' -Namespace Win32 -PassThru
# $api::ucnvsel_serialize(sel, buffer, bufferCapacity, status)
#uselib "icuuc.dll"
#func global ucnvsel_serialize "ucnvsel_serialize" sptr, sptr, sptr, sptr
; ucnvsel_serialize sel, buffer, bufferCapacity, status   ; 戻り値は stat
; sel : UConverterSelector* -> "sptr"
; buffer : void* in/out -> "sptr"
; bufferCapacity : INT -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "icuuc.dll"
#cfunc global ucnvsel_serialize "ucnvsel_serialize" int, sptr, int, int
; res = ucnvsel_serialize(sel, buffer, bufferCapacity, status)
; sel : UConverterSelector* -> "int"
; buffer : void* in/out -> "sptr"
; bufferCapacity : INT -> "int"
; status : UErrorCode* in/out -> "int"
; INT ucnvsel_serialize(UConverterSelector* sel, void* buffer, INT bufferCapacity, UErrorCode* status)
#uselib "icuuc.dll"
#cfunc global ucnvsel_serialize "ucnvsel_serialize" int, intptr, int, int
; res = ucnvsel_serialize(sel, buffer, bufferCapacity, status)
; sel : UConverterSelector* -> "int"
; buffer : void* in/out -> "intptr"
; bufferCapacity : INT -> "int"
; status : UErrorCode* in/out -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procucnvsel_serialize = icuuc.NewProc("ucnvsel_serialize")
)

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