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