ホーム › Globalization › ucurr_forLocale
ucurr_forLocale
関数指定ロケールの既定の通貨コードを取得する。
シグネチャ
// icuuc.dll
#include <windows.h>
INT ucurr_forLocale(
LPCSTR locale,
WORD* buff,
INT buffCapacity,
UErrorCode* ec
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| locale | LPCSTR | in |
| buff | WORD* | inout |
| buffCapacity | INT | in |
| ec | UErrorCode* | inout |
戻り値の型: INT
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
INT ucurr_forLocale(
LPCSTR locale,
WORD* buff,
INT buffCapacity,
UErrorCode* ec
);[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int ucurr_forLocale(
[MarshalAs(UnmanagedType.LPStr)] string locale, // LPCSTR
ref ushort buff, // WORD* in/out
int buffCapacity, // INT
ref int ec // UErrorCode* in/out
);<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ucurr_forLocale(
<MarshalAs(UnmanagedType.LPStr)> locale As String, ' LPCSTR
ByRef buff As UShort, ' WORD* in/out
buffCapacity As Integer, ' INT
ByRef ec As Integer ' UErrorCode* in/out
) As Integer
End Function' locale : LPCSTR
' buff : WORD* in/out
' buffCapacity : INT
' ec : UErrorCode* in/out
Declare PtrSafe Function ucurr_forLocale Lib "icuuc" ( _
ByVal locale As String, _
ByRef buff As Integer, _
ByVal buffCapacity As Long, _
ByRef ec As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ucurr_forLocale = ctypes.cdll.icuuc.ucurr_forLocale
ucurr_forLocale.restype = ctypes.c_int
ucurr_forLocale.argtypes = [
wintypes.LPCSTR, # locale : LPCSTR
ctypes.POINTER(ctypes.c_ushort), # buff : WORD* in/out
ctypes.c_int, # buffCapacity : INT
ctypes.c_void_p, # ec : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuuc.dll')
ucurr_forLocale = Fiddle::Function.new(
lib['ucurr_forLocale'],
[
Fiddle::TYPE_VOIDP, # locale : LPCSTR
Fiddle::TYPE_VOIDP, # buff : WORD* in/out
Fiddle::TYPE_INT, # buffCapacity : INT
Fiddle::TYPE_VOIDP, # ec : UErrorCode* in/out
],
Fiddle::TYPE_INT, Fiddle::Function::CDECL)#[link(name = "icuuc")]
extern "C" {
fn ucurr_forLocale(
locale: *const u8, // LPCSTR
buff: *mut u16, // WORD* in/out
buffCapacity: i32, // INT
ec: *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 ucurr_forLocale([MarshalAs(UnmanagedType.LPStr)] string locale, ref ushort buff, int buffCapacity, ref int ec);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_ucurr_forLocale' -Namespace Win32 -PassThru
# $api::ucurr_forLocale(locale, buff, buffCapacity, ec)#uselib "icuuc.dll"
#func global ucurr_forLocale "ucurr_forLocale" sptr, sptr, sptr, sptr
; ucurr_forLocale locale, varptr(buff), buffCapacity, ec ; 戻り値は stat
; locale : LPCSTR -> "sptr"
; buff : WORD* in/out -> "sptr"
; buffCapacity : INT -> "sptr"
; ec : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuuc.dll" #cfunc global ucurr_forLocale "ucurr_forLocale" str, var, int, int ; res = ucurr_forLocale(locale, buff, buffCapacity, ec) ; locale : LPCSTR -> "str" ; buff : WORD* in/out -> "var" ; buffCapacity : INT -> "int" ; ec : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuuc.dll" #cfunc global ucurr_forLocale "ucurr_forLocale" str, sptr, int, int ; res = ucurr_forLocale(locale, varptr(buff), buffCapacity, ec) ; locale : LPCSTR -> "str" ; buff : WORD* in/out -> "sptr" ; buffCapacity : INT -> "int" ; ec : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT ucurr_forLocale(LPCSTR locale, WORD* buff, INT buffCapacity, UErrorCode* ec) #uselib "icuuc.dll" #cfunc global ucurr_forLocale "ucurr_forLocale" str, var, int, int ; res = ucurr_forLocale(locale, buff, buffCapacity, ec) ; locale : LPCSTR -> "str" ; buff : WORD* in/out -> "var" ; buffCapacity : INT -> "int" ; ec : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT ucurr_forLocale(LPCSTR locale, WORD* buff, INT buffCapacity, UErrorCode* ec) #uselib "icuuc.dll" #cfunc global ucurr_forLocale "ucurr_forLocale" str, intptr, int, int ; res = ucurr_forLocale(locale, varptr(buff), buffCapacity, ec) ; locale : LPCSTR -> "str" ; buff : WORD* in/out -> "intptr" ; buffCapacity : INT -> "int" ; ec : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuuc = windows.NewLazySystemDLL("icuuc.dll")
procucurr_forLocale = icuuc.NewProc("ucurr_forLocale")
)
// locale (LPCSTR), buff (WORD* in/out), buffCapacity (INT), ec (UErrorCode* in/out)
r1, _, err := procucurr_forLocale.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(locale))),
uintptr(buff),
uintptr(buffCapacity),
uintptr(ec),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction ucurr_forLocale(
locale: PAnsiChar; // LPCSTR
buff: Pointer; // WORD* in/out
buffCapacity: Integer; // INT
ec: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icuuc.dll' name 'ucurr_forLocale';result := DllCall("icuuc\ucurr_forLocale"
, "AStr", locale ; LPCSTR
, "Ptr", buff ; WORD* in/out
, "Int", buffCapacity ; INT
, "Ptr", ec ; UErrorCode* in/out
, "Cdecl Int") ; return: INT●ucurr_forLocale(locale, buff, buffCapacity, ec) = DLL("icuuc.dll", "int ucurr_forLocale(char*, void*, int, void*)")
# 呼び出し: ucurr_forLocale(locale, buff, buffCapacity, ec)
# locale : LPCSTR -> "char*"
# buff : WORD* in/out -> "void*"
# buffCapacity : INT -> "int"
# ec : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。