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

ucnv_getCCSID

関数
変換器のCCSIDコードページ番号を取得する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

INT ucnv_getCCSID(
    const UConverter* converter,
    UErrorCode* err
);

パラメーター

名前方向
converterUConverter*in
errUErrorCode*inout

戻り値の型: INT

各言語での呼び出し定義

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

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

ucnv_getCCSID = ctypes.cdll.icuuc.ucnv_getCCSID
ucnv_getCCSID.restype = ctypes.c_int
ucnv_getCCSID.argtypes = [
    ctypes.c_void_p,  # converter : UConverter*
    ctypes.c_void_p,  # err : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
ucnv_getCCSID = Fiddle::Function.new(
  lib['ucnv_getCCSID'],
  [
    Fiddle::TYPE_VOIDP,  # converter : UConverter*
    Fiddle::TYPE_VOIDP,  # err : UErrorCode* in/out
  ],
  Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn ucnv_getCCSID(
        converter: *const isize,  // UConverter*
        err: *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 ucnv_getCCSID(ref IntPtr converter, ref int err);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_ucnv_getCCSID' -Namespace Win32 -PassThru
# $api::ucnv_getCCSID(converter, err)
#uselib "icuuc.dll"
#func global ucnv_getCCSID "ucnv_getCCSID" sptr, sptr
; ucnv_getCCSID converter, err   ; 戻り値は stat
; converter : UConverter* -> "sptr"
; err : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "icuuc.dll"
#cfunc global ucnv_getCCSID "ucnv_getCCSID" int, int
; res = ucnv_getCCSID(converter, err)
; converter : UConverter* -> "int"
; err : UErrorCode* in/out -> "int"
; INT ucnv_getCCSID(UConverter* converter, UErrorCode* err)
#uselib "icuuc.dll"
#cfunc global ucnv_getCCSID "ucnv_getCCSID" int, int
; res = ucnv_getCCSID(converter, err)
; converter : UConverter* -> "int"
; err : UErrorCode* in/out -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procucnv_getCCSID = icuuc.NewProc("ucnv_getCCSID")
)

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