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

ucnv_clone

関数
文字コード変換器を複製する。
DLLicu.dll呼出規約cdecl

シグネチャ

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

UConverter* ucnv_clone(
    const UConverter* cnv,
    UErrorCode* status
);

パラメーター

名前方向
cnvUConverter*in
statusUErrorCode*inout

戻り値の型: UConverter*

各言語での呼び出し定義

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

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

ucnv_clone = ctypes.cdll.icu.ucnv_clone
ucnv_clone.restype = ctypes.c_void_p
ucnv_clone.argtypes = [
    ctypes.c_void_p,  # cnv : UConverter*
    ctypes.c_void_p,  # status : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	icu = windows.NewLazySystemDLL("icu.dll")
	procucnv_clone = icu.NewProc("ucnv_clone")
)

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