ホーム › Globalization › uset_getSerializedSet
uset_getSerializedSet
関数直列化データから読み取り用USerializedSetを構築する。
シグネチャ
// icuuc.dll
#include <windows.h>
CHAR uset_getSerializedSet(
USerializedSet* fillSet,
const WORD* src,
INT srcLength
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| fillSet | USerializedSet* | inout | デシリアライズ結果を格納するUSerializedSet構造体へのポインタ。 |
| src | WORD* | in | シリアライズ済みデータ(uint16_t配列)へのポインタ。 |
| srcLength | INT | in | srcの長さ(uint16_t単位)。 |
戻り値の型: CHAR
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
CHAR uset_getSerializedSet(
USerializedSet* fillSet,
const WORD* src,
INT srcLength
);[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern sbyte uset_getSerializedSet(
IntPtr fillSet, // USerializedSet* in/out
ref ushort src, // WORD*
int srcLength // INT
);<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function uset_getSerializedSet(
fillSet As IntPtr, ' USerializedSet* in/out
ByRef src As UShort, ' WORD*
srcLength As Integer ' INT
) As SByte
End Function' fillSet : USerializedSet* in/out
' src : WORD*
' srcLength : INT
Declare PtrSafe Function uset_getSerializedSet Lib "icuuc" ( _
ByVal fillSet As LongPtr, _
ByRef src As Integer, _
ByVal srcLength As Long) As Byte
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
uset_getSerializedSet = ctypes.cdll.icuuc.uset_getSerializedSet
uset_getSerializedSet.restype = ctypes.c_byte
uset_getSerializedSet.argtypes = [
ctypes.c_void_p, # fillSet : USerializedSet* in/out
ctypes.POINTER(ctypes.c_ushort), # src : WORD*
ctypes.c_int, # srcLength : INT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuuc.dll')
uset_getSerializedSet = Fiddle::Function.new(
lib['uset_getSerializedSet'],
[
Fiddle::TYPE_VOIDP, # fillSet : USerializedSet* in/out
Fiddle::TYPE_VOIDP, # src : WORD*
Fiddle::TYPE_INT, # srcLength : INT
],
Fiddle::TYPE_CHAR, Fiddle::Function::CDECL)#[link(name = "icuuc")]
extern "C" {
fn uset_getSerializedSet(
fillSet: *mut USerializedSet, // USerializedSet* in/out
src: *const u16, // WORD*
srcLength: i32 // INT
) -> i8;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern sbyte uset_getSerializedSet(IntPtr fillSet, ref ushort src, int srcLength);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_uset_getSerializedSet' -Namespace Win32 -PassThru
# $api::uset_getSerializedSet(fillSet, src, srcLength)#uselib "icuuc.dll"
#func global uset_getSerializedSet "uset_getSerializedSet" sptr, sptr, sptr
; uset_getSerializedSet varptr(fillSet), varptr(src), srcLength ; 戻り値は stat
; fillSet : USerializedSet* in/out -> "sptr"
; src : WORD* -> "sptr"
; srcLength : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuuc.dll" #cfunc global uset_getSerializedSet "uset_getSerializedSet" var, var, int ; res = uset_getSerializedSet(fillSet, src, srcLength) ; fillSet : USerializedSet* in/out -> "var" ; src : WORD* -> "var" ; srcLength : INT -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuuc.dll" #cfunc global uset_getSerializedSet "uset_getSerializedSet" sptr, sptr, int ; res = uset_getSerializedSet(varptr(fillSet), varptr(src), srcLength) ; fillSet : USerializedSet* in/out -> "sptr" ; src : WORD* -> "sptr" ; srcLength : INT -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; CHAR uset_getSerializedSet(USerializedSet* fillSet, WORD* src, INT srcLength) #uselib "icuuc.dll" #cfunc global uset_getSerializedSet "uset_getSerializedSet" var, var, int ; res = uset_getSerializedSet(fillSet, src, srcLength) ; fillSet : USerializedSet* in/out -> "var" ; src : WORD* -> "var" ; srcLength : INT -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; CHAR uset_getSerializedSet(USerializedSet* fillSet, WORD* src, INT srcLength) #uselib "icuuc.dll" #cfunc global uset_getSerializedSet "uset_getSerializedSet" intptr, intptr, int ; res = uset_getSerializedSet(varptr(fillSet), varptr(src), srcLength) ; fillSet : USerializedSet* in/out -> "intptr" ; src : WORD* -> "intptr" ; srcLength : INT -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuuc = windows.NewLazySystemDLL("icuuc.dll")
procuset_getSerializedSet = icuuc.NewProc("uset_getSerializedSet")
)
// fillSet (USerializedSet* in/out), src (WORD*), srcLength (INT)
r1, _, err := procuset_getSerializedSet.Call(
uintptr(fillSet),
uintptr(src),
uintptr(srcLength),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // CHARfunction uset_getSerializedSet(
fillSet: Pointer; // USerializedSet* in/out
src: Pointer; // WORD*
srcLength: Integer // INT
): Shortint; cdecl;
external 'icuuc.dll' name 'uset_getSerializedSet';result := DllCall("icuuc\uset_getSerializedSet"
, "Ptr", fillSet ; USerializedSet* in/out
, "Ptr", src ; WORD*
, "Int", srcLength ; INT
, "Cdecl Char") ; return: CHAR●uset_getSerializedSet(fillSet, src, srcLength) = DLL("icuuc.dll", "char uset_getSerializedSet(void*, void*, int)")
# 呼び出し: uset_getSerializedSet(fillSet, src, srcLength)
# fillSet : USerializedSet* in/out -> "void*"
# src : WORD* -> "void*"
# srcLength : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。const std = @import("std");
extern "icuuc" fn uset_getSerializedSet(
fillSet: [*c]USerializedSet, // USerializedSet* in/out
src: [*c]u16, // WORD*
srcLength: i32 // INT
) callconv(.c) i8;proc uset_getSerializedSet(
fillSet: ptr USerializedSet, # USerializedSet* in/out
src: ptr uint16, # WORD*
srcLength: int32 # INT
): int8 {.importc: "uset_getSerializedSet", cdecl, dynlib: "icuuc.dll".}pragma(lib, "icuuc");
extern(C)
byte uset_getSerializedSet(
USerializedSet* fillSet, // USerializedSet* in/out
ushort* src, // WORD*
int srcLength // INT
);ccall((:uset_getSerializedSet, "icuuc.dll"), Int8,
(Ptr{USerializedSet}, Ptr{UInt16}, Int32),
fillSet, src, srcLength)
# fillSet : USerializedSet* in/out -> Ptr{USerializedSet}
# src : WORD* -> Ptr{UInt16}
# srcLength : INT -> Int32local ffi = require("ffi")
ffi.cdef[[
int8_t uset_getSerializedSet(
void* fillSet,
uint16_t* src,
int32_t srcLength);
]]
local icuuc = ffi.load("icuuc")
-- icuuc.uset_getSerializedSet(fillSet, src, srcLength)
-- fillSet : USerializedSet* in/out
-- src : WORD*
-- srcLength : INT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icuuc.dll');
const uset_getSerializedSet = lib.func('__cdecl', 'uset_getSerializedSet', 'int8_t', ['void *', 'uint16_t *', 'int32_t']);
// uset_getSerializedSet(fillSet, src, srcLength)
// fillSet : USerializedSet* in/out -> 'void *'
// src : WORD* -> 'uint16_t *'
// srcLength : INT -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("icuuc.dll", {
uset_getSerializedSet: { parameters: ["pointer", "pointer", "i32"], result: "i8" },
});
// lib.symbols.uset_getSerializedSet(fillSet, src, srcLength)
// fillSet : USerializedSet* in/out -> "pointer"
// src : WORD* -> "pointer"
// srcLength : INT -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int8_t uset_getSerializedSet(
void* fillSet,
uint16_t* src,
int32_t srcLength);
C, "icuuc.dll");
// $ffi->uset_getSerializedSet(fillSet, src, srcLength);
// fillSet : USerializedSet* in/out
// src : WORD*
// srcLength : INT
// 構造体/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 Icuuc extends Library {
Icuuc INSTANCE = Native.load("icuuc", Icuuc.class);
byte uset_getSerializedSet(
Pointer fillSet, // USerializedSet* in/out
ShortByReference src, // WORD*
int srcLength // INT
);
}@[Link("icuuc")]
lib Libicuuc
fun uset_getSerializedSet = uset_getSerializedSet(
fillSet : USerializedSet*, # USerializedSet* in/out
src : UInt16*, # WORD*
srcLength : Int32 # INT
) : Int8
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef uset_getSerializedSetNative = Int8 Function(Pointer<Void>, Pointer<Uint16>, Int32);
typedef uset_getSerializedSetDart = int Function(Pointer<Void>, Pointer<Uint16>, int);
final uset_getSerializedSet = DynamicLibrary.open('icuuc.dll')
.lookupFunction<uset_getSerializedSetNative, uset_getSerializedSetDart>('uset_getSerializedSet');
// fillSet : USerializedSet* in/out -> Pointer<Void>
// src : WORD* -> Pointer<Uint16>
// srcLength : INT -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function uset_getSerializedSet(
fillSet: Pointer; // USerializedSet* in/out
src: Pointer; // WORD*
srcLength: Integer // INT
): Shortint; cdecl;
external 'icuuc.dll' name 'uset_getSerializedSet';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "uset_getSerializedSet"
c_uset_getSerializedSet :: Ptr () -> Ptr Word16 -> Int32 -> IO Int8
-- fillSet : USerializedSet* in/out -> Ptr ()
-- src : WORD* -> Ptr Word16
-- srcLength : INT -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let uset_getserializedset =
foreign "uset_getSerializedSet"
((ptr void) @-> (ptr uint16_t) @-> int32_t @-> returning int8_t)
(* fillSet : USerializedSet* in/out -> (ptr void) *)
(* src : WORD* -> (ptr uint16_t) *)
(* srcLength : INT -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library icuuc (t "icuuc.dll"))
(cffi:use-foreign-library icuuc)
(cffi:defcfun ("uset_getSerializedSet" uset-get-serialized-set :convention :cdecl) :int8
(fill-set :pointer) ; USerializedSet* in/out
(src :pointer) ; WORD*
(src-length :int32)) ; INT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $uset_getSerializedSet = Win32::API::More->new('icuuc',
'char uset_getSerializedSet(LPVOID fillSet, LPVOID src, int srcLength)');
# my $ret = $uset_getSerializedSet->Call($fillSet, $src, $srcLength);
# fillSet : USerializedSet* in/out -> LPVOID
# src : WORD* -> LPVOID
# srcLength : INT -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型