ホーム › Globalization › unum_formatInt64
unum_formatInt64
関数64ビット整数を文字列に整形する。
シグネチャ
// icuin.dll
#include <windows.h>
INT unum_formatInt64(
const void** fmt,
LONGLONG number,
WORD* result,
INT resultLength,
UFieldPosition* pos,
UErrorCode* status
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| fmt | void** | in |
| number | LONGLONG | in |
| result | WORD* | inout |
| resultLength | INT | in |
| pos | UFieldPosition* | inout |
| status | UErrorCode* | inout |
戻り値の型: INT
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
INT unum_formatInt64(
const void** fmt,
LONGLONG number,
WORD* result,
INT resultLength,
UFieldPosition* pos,
UErrorCode* status
);[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int unum_formatInt64(
IntPtr fmt, // void**
long number, // LONGLONG
ref ushort result, // WORD* in/out
int resultLength, // INT
IntPtr pos, // UFieldPosition* in/out
ref int status // UErrorCode* in/out
);<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function unum_formatInt64(
fmt As IntPtr, ' void**
number As Long, ' LONGLONG
ByRef result As UShort, ' WORD* in/out
resultLength As Integer, ' INT
pos As IntPtr, ' UFieldPosition* in/out
ByRef status As Integer ' UErrorCode* in/out
) As Integer
End Function' fmt : void**
' number : LONGLONG
' result : WORD* in/out
' resultLength : INT
' pos : UFieldPosition* in/out
' status : UErrorCode* in/out
Declare PtrSafe Function unum_formatInt64 Lib "icuin" ( _
ByVal fmt As LongPtr, _
ByVal number As LongLong, _
ByRef result As Integer, _
ByVal resultLength As Long, _
ByVal pos As LongPtr, _
ByRef status As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
unum_formatInt64 = ctypes.cdll.icuin.unum_formatInt64
unum_formatInt64.restype = ctypes.c_int
unum_formatInt64.argtypes = [
ctypes.c_void_p, # fmt : void**
ctypes.c_longlong, # number : LONGLONG
ctypes.POINTER(ctypes.c_ushort), # result : WORD* in/out
ctypes.c_int, # resultLength : INT
ctypes.c_void_p, # pos : UFieldPosition* in/out
ctypes.c_void_p, # status : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuin.dll')
unum_formatInt64 = Fiddle::Function.new(
lib['unum_formatInt64'],
[
Fiddle::TYPE_VOIDP, # fmt : void**
Fiddle::TYPE_LONG_LONG, # number : LONGLONG
Fiddle::TYPE_VOIDP, # result : WORD* in/out
Fiddle::TYPE_INT, # resultLength : INT
Fiddle::TYPE_VOIDP, # pos : UFieldPosition* in/out
Fiddle::TYPE_VOIDP, # status : UErrorCode* in/out
],
Fiddle::TYPE_INT, Fiddle::Function::CDECL)#[link(name = "icuin")]
extern "C" {
fn unum_formatInt64(
fmt: *const *const (), // void**
number: i64, // LONGLONG
result: *mut u16, // WORD* in/out
resultLength: i32, // INT
pos: *mut UFieldPosition, // UFieldPosition* in/out
status: *mut i32 // UErrorCode* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int unum_formatInt64(IntPtr fmt, long number, ref ushort result, int resultLength, IntPtr pos, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_unum_formatInt64' -Namespace Win32 -PassThru
# $api::unum_formatInt64(fmt, number, result, resultLength, pos, status)#uselib "icuin.dll"
#func global unum_formatInt64 "unum_formatInt64" sptr, sptr, sptr, sptr, sptr, sptr
; unum_formatInt64 fmt, number, varptr(result), resultLength, varptr(pos), status ; 戻り値は stat
; fmt : void** -> "sptr"
; number : LONGLONG -> "sptr"
; result : WORD* in/out -> "sptr"
; resultLength : INT -> "sptr"
; pos : UFieldPosition* in/out -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuin.dll" #cfunc global unum_formatInt64 "unum_formatInt64" sptr, int64, var, int, var, int ; res = unum_formatInt64(fmt, number, result, resultLength, pos, status) ; fmt : void** -> "sptr" ; number : LONGLONG -> "int64" ; result : WORD* in/out -> "var" ; resultLength : INT -> "int" ; pos : UFieldPosition* in/out -> "var" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。 ; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。#uselib "icuin.dll" #cfunc global unum_formatInt64 "unum_formatInt64" sptr, int64, sptr, int, sptr, int ; res = unum_formatInt64(fmt, number, varptr(result), resultLength, varptr(pos), status) ; fmt : void** -> "sptr" ; number : LONGLONG -> "int64" ; result : WORD* in/out -> "sptr" ; resultLength : INT -> "int" ; pos : UFieldPosition* in/out -> "sptr" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。 ; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
出力引数:
; INT unum_formatInt64(void** fmt, LONGLONG number, WORD* result, INT resultLength, UFieldPosition* pos, UErrorCode* status) #uselib "icuin.dll" #cfunc global unum_formatInt64 "unum_formatInt64" intptr, int64, var, int, var, int ; res = unum_formatInt64(fmt, number, result, resultLength, pos, status) ; fmt : void** -> "intptr" ; number : LONGLONG -> "int64" ; result : WORD* in/out -> "var" ; resultLength : INT -> "int" ; pos : UFieldPosition* in/out -> "var" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT unum_formatInt64(void** fmt, LONGLONG number, WORD* result, INT resultLength, UFieldPosition* pos, UErrorCode* status) #uselib "icuin.dll" #cfunc global unum_formatInt64 "unum_formatInt64" intptr, int64, intptr, int, intptr, int ; res = unum_formatInt64(fmt, number, varptr(result), resultLength, varptr(pos), status) ; fmt : void** -> "intptr" ; number : LONGLONG -> "int64" ; result : WORD* in/out -> "intptr" ; resultLength : INT -> "int" ; pos : UFieldPosition* in/out -> "intptr" ; status : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuin = windows.NewLazySystemDLL("icuin.dll")
procunum_formatInt64 = icuin.NewProc("unum_formatInt64")
)
// fmt (void**), number (LONGLONG), result (WORD* in/out), resultLength (INT), pos (UFieldPosition* in/out), status (UErrorCode* in/out)
r1, _, err := procunum_formatInt64.Call(
uintptr(fmt),
uintptr(number),
uintptr(result),
uintptr(resultLength),
uintptr(pos),
uintptr(status),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction unum_formatInt64(
fmt: Pointer; // void**
number: Int64; // LONGLONG
result: Pointer; // WORD* in/out
resultLength: Integer; // INT
pos: Pointer; // UFieldPosition* in/out
status: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icuin.dll' name 'unum_formatInt64';result := DllCall("icuin\unum_formatInt64"
, "Ptr", fmt ; void**
, "Int64", number ; LONGLONG
, "Ptr", result ; WORD* in/out
, "Int", resultLength ; INT
, "Ptr", pos ; UFieldPosition* in/out
, "Ptr", status ; UErrorCode* in/out
, "Cdecl Int") ; return: INT●unum_formatInt64(fmt, number, result, resultLength, pos, status) = DLL("icuin.dll", "int unum_formatInt64(void*, int64, void*, int, void*, void*)")
# 呼び出し: unum_formatInt64(fmt, number, result, resultLength, pos, status)
# fmt : void** -> "void*"
# number : LONGLONG -> "int64"
# result : WORD* in/out -> "void*"
# resultLength : INT -> "int"
# pos : UFieldPosition* in/out -> "void*"
# status : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。