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