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