ホーム › Globalization › ucol_safeClone
ucol_safeClone
関数コレータをスタックバッファ上に安全に複製する。
シグネチャ
// icuin.dll
#include <windows.h>
UCollator* ucol_safeClone(
const UCollator* coll,
void* stackBuffer,
INT* pBufferSize,
UErrorCode* status
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| coll | UCollator* | in |
| stackBuffer | void* | inout |
| pBufferSize | INT* | inout |
| status | UErrorCode* | inout |
戻り値の型: UCollator*
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
UCollator* ucol_safeClone(
const UCollator* coll,
void* stackBuffer,
INT* pBufferSize,
UErrorCode* status
);[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr ucol_safeClone(
ref IntPtr coll, // UCollator*
IntPtr stackBuffer, // void* in/out
ref int pBufferSize, // INT* in/out
ref int status // UErrorCode* in/out
);<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ucol_safeClone(
ByRef coll As IntPtr, ' UCollator*
stackBuffer As IntPtr, ' void* in/out
ByRef pBufferSize As Integer, ' INT* in/out
ByRef status As Integer ' UErrorCode* in/out
) As IntPtr
End Function' coll : UCollator*
' stackBuffer : void* in/out
' pBufferSize : INT* in/out
' status : UErrorCode* in/out
Declare PtrSafe Function ucol_safeClone Lib "icuin" ( _
ByRef coll As LongPtr, _
ByVal stackBuffer As LongPtr, _
ByRef pBufferSize As Long, _
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_safeClone = ctypes.cdll.icuin.ucol_safeClone
ucol_safeClone.restype = ctypes.c_void_p
ucol_safeClone.argtypes = [
ctypes.c_void_p, # coll : UCollator*
ctypes.POINTER(None), # stackBuffer : void* in/out
ctypes.POINTER(ctypes.c_int), # pBufferSize : INT* in/out
ctypes.c_void_p, # status : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuin.dll')
ucol_safeClone = Fiddle::Function.new(
lib['ucol_safeClone'],
[
Fiddle::TYPE_VOIDP, # coll : UCollator*
Fiddle::TYPE_VOIDP, # stackBuffer : void* in/out
Fiddle::TYPE_VOIDP, # pBufferSize : INT* in/out
Fiddle::TYPE_VOIDP, # status : UErrorCode* in/out
],
Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)#[link(name = "icuin")]
extern "C" {
fn ucol_safeClone(
coll: *const isize, // UCollator*
stackBuffer: *mut (), // void* in/out
pBufferSize: *mut i32, // INT* in/out
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_safeClone(ref IntPtr coll, IntPtr stackBuffer, ref int pBufferSize, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_ucol_safeClone' -Namespace Win32 -PassThru
# $api::ucol_safeClone(coll, stackBuffer, pBufferSize, status)#uselib "icuin.dll"
#func global ucol_safeClone "ucol_safeClone" sptr, sptr, sptr, sptr
; ucol_safeClone coll, stackBuffer, varptr(pBufferSize), status ; 戻り値は stat
; coll : UCollator* -> "sptr"
; stackBuffer : void* in/out -> "sptr"
; pBufferSize : INT* in/out -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuin.dll" #cfunc global ucol_safeClone "ucol_safeClone" int, sptr, var, int ; res = ucol_safeClone(coll, stackBuffer, pBufferSize, status) ; coll : UCollator* -> "int" ; stackBuffer : void* in/out -> "sptr" ; pBufferSize : INT* in/out -> "var" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuin.dll" #cfunc global ucol_safeClone "ucol_safeClone" int, sptr, sptr, int ; res = ucol_safeClone(coll, stackBuffer, varptr(pBufferSize), status) ; coll : UCollator* -> "int" ; stackBuffer : void* in/out -> "sptr" ; pBufferSize : INT* in/out -> "sptr" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; UCollator* ucol_safeClone(UCollator* coll, void* stackBuffer, INT* pBufferSize, UErrorCode* status) #uselib "icuin.dll" #cfunc global ucol_safeClone "ucol_safeClone" int, intptr, var, int ; res = ucol_safeClone(coll, stackBuffer, pBufferSize, status) ; coll : UCollator* -> "int" ; stackBuffer : void* in/out -> "intptr" ; pBufferSize : INT* in/out -> "var" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; UCollator* ucol_safeClone(UCollator* coll, void* stackBuffer, INT* pBufferSize, UErrorCode* status) #uselib "icuin.dll" #cfunc global ucol_safeClone "ucol_safeClone" int, intptr, intptr, int ; res = ucol_safeClone(coll, stackBuffer, varptr(pBufferSize), status) ; coll : UCollator* -> "int" ; stackBuffer : void* in/out -> "intptr" ; pBufferSize : INT* in/out -> "intptr" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuin = windows.NewLazySystemDLL("icuin.dll")
procucol_safeClone = icuin.NewProc("ucol_safeClone")
)
// coll (UCollator*), stackBuffer (void* in/out), pBufferSize (INT* in/out), status (UErrorCode* in/out)
r1, _, err := procucol_safeClone.Call(
uintptr(coll),
uintptr(stackBuffer),
uintptr(pBufferSize),
uintptr(status),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // UCollator*function ucol_safeClone(
coll: Pointer; // UCollator*
stackBuffer: Pointer; // void* in/out
pBufferSize: Pointer; // INT* in/out
status: Pointer // UErrorCode* in/out
): Pointer; cdecl;
external 'icuin.dll' name 'ucol_safeClone';result := DllCall("icuin\ucol_safeClone"
, "Ptr", coll ; UCollator*
, "Ptr", stackBuffer ; void* in/out
, "Ptr", pBufferSize ; INT* in/out
, "Ptr", status ; UErrorCode* in/out
, "Cdecl Ptr") ; return: UCollator*●ucol_safeClone(coll, stackBuffer, pBufferSize, status) = DLL("icuin.dll", "void* ucol_safeClone(void*, void*, void*, void*)")
# 呼び出し: ucol_safeClone(coll, stackBuffer, pBufferSize, status)
# coll : UCollator* -> "void*"
# stackBuffer : void* in/out -> "void*"
# pBufferSize : INT* in/out -> "void*"
# status : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。