ホーム › Globalization › u_catopen
u_catopen
関数メッセージカタログをロケール指定で開く。
シグネチャ
// icuuc.dll
#include <windows.h>
UResourceBundle* u_catopen(
LPCSTR name,
LPCSTR locale,
UErrorCode* ec
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| name | LPCSTR | in |
| locale | LPCSTR | in |
| ec | UErrorCode* | inout |
戻り値の型: UResourceBundle*
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
UResourceBundle* u_catopen(
LPCSTR name,
LPCSTR locale,
UErrorCode* ec
);[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr u_catopen(
[MarshalAs(UnmanagedType.LPStr)] string name, // LPCSTR
[MarshalAs(UnmanagedType.LPStr)] string locale, // LPCSTR
ref int ec // UErrorCode* in/out
);<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function u_catopen(
<MarshalAs(UnmanagedType.LPStr)> name As String, ' LPCSTR
<MarshalAs(UnmanagedType.LPStr)> locale As String, ' LPCSTR
ByRef ec As Integer ' UErrorCode* in/out
) As IntPtr
End Function' name : LPCSTR
' locale : LPCSTR
' ec : UErrorCode* in/out
Declare PtrSafe Function u_catopen Lib "icuuc" ( _
ByVal name As String, _
ByVal locale As String, _
ByRef ec As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
u_catopen = ctypes.cdll.icuuc.u_catopen
u_catopen.restype = ctypes.c_void_p
u_catopen.argtypes = [
wintypes.LPCSTR, # name : LPCSTR
wintypes.LPCSTR, # locale : LPCSTR
ctypes.c_void_p, # ec : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuuc.dll')
u_catopen = Fiddle::Function.new(
lib['u_catopen'],
[
Fiddle::TYPE_VOIDP, # name : LPCSTR
Fiddle::TYPE_VOIDP, # locale : LPCSTR
Fiddle::TYPE_VOIDP, # ec : UErrorCode* in/out
],
Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)#[link(name = "icuuc")]
extern "C" {
fn u_catopen(
name: *const u8, // LPCSTR
locale: *const u8, // LPCSTR
ec: *mut i32 // UErrorCode* in/out
) -> *mut isize;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr u_catopen([MarshalAs(UnmanagedType.LPStr)] string name, [MarshalAs(UnmanagedType.LPStr)] string locale, ref int ec);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_u_catopen' -Namespace Win32 -PassThru
# $api::u_catopen(name, locale, ec)#uselib "icuuc.dll"
#func global u_catopen "u_catopen" sptr, sptr, sptr
; u_catopen name, locale, ec ; 戻り値は stat
; name : LPCSTR -> "sptr"
; locale : LPCSTR -> "sptr"
; ec : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "icuuc.dll"
#cfunc global u_catopen "u_catopen" str, str, int
; res = u_catopen(name, locale, ec)
; name : LPCSTR -> "str"
; locale : LPCSTR -> "str"
; ec : UErrorCode* in/out -> "int"; UResourceBundle* u_catopen(LPCSTR name, LPCSTR locale, UErrorCode* ec)
#uselib "icuuc.dll"
#cfunc global u_catopen "u_catopen" str, str, int
; res = u_catopen(name, locale, ec)
; name : LPCSTR -> "str"
; locale : LPCSTR -> "str"
; ec : UErrorCode* in/out -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuuc = windows.NewLazySystemDLL("icuuc.dll")
procu_catopen = icuuc.NewProc("u_catopen")
)
// name (LPCSTR), locale (LPCSTR), ec (UErrorCode* in/out)
r1, _, err := procu_catopen.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(name))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(locale))),
uintptr(ec),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // UResourceBundle*function u_catopen(
name: PAnsiChar; // LPCSTR
locale: PAnsiChar; // LPCSTR
ec: Pointer // UErrorCode* in/out
): Pointer; cdecl;
external 'icuuc.dll' name 'u_catopen';result := DllCall("icuuc\u_catopen"
, "AStr", name ; LPCSTR
, "AStr", locale ; LPCSTR
, "Ptr", ec ; UErrorCode* in/out
, "Cdecl Ptr") ; return: UResourceBundle*●u_catopen(name, locale, ec) = DLL("icuuc.dll", "void* u_catopen(char*, char*, void*)")
# 呼び出し: u_catopen(name, locale, ec)
# name : LPCSTR -> "char*"
# locale : LPCSTR -> "char*"
# ec : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。