Win32 API 日本語リファレンス
ホームGlobalization › ucal_getGregorianChange

ucal_getGregorianChange

関数
グレゴリオ暦への切替日を取得する。
DLLicuin.dll呼出規約cdecl

シグネチャ

// icuin.dll
#include <windows.h>

DOUBLE ucal_getGregorianChange(
    const void** cal,
    UErrorCode* pErrorCode
);

パラメーター

名前方向
calvoid**in
pErrorCodeUErrorCode*inout

戻り値の型: DOUBLE

各言語での呼び出し定義

// icuin.dll
#include <windows.h>

DOUBLE ucal_getGregorianChange(
    const void** cal,
    UErrorCode* pErrorCode
);
[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern double ucal_getGregorianChange(
    IntPtr cal,   // void**
    ref int pErrorCode   // UErrorCode* in/out
);
<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ucal_getGregorianChange(
    cal As IntPtr,   ' void**
    ByRef pErrorCode As Integer   ' UErrorCode* in/out
) As Double
End Function
' cal : void**
' pErrorCode : UErrorCode* in/out
Declare PtrSafe Function ucal_getGregorianChange Lib "icuin" ( _
    ByVal cal As LongPtr, _
    ByRef pErrorCode As Long) As Double
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ucal_getGregorianChange = ctypes.cdll.icuin.ucal_getGregorianChange
ucal_getGregorianChange.restype = ctypes.c_double
ucal_getGregorianChange.argtypes = [
    ctypes.c_void_p,  # cal : void**
    ctypes.c_void_p,  # pErrorCode : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuin.dll')
ucal_getGregorianChange = Fiddle::Function.new(
  lib['ucal_getGregorianChange'],
  [
    Fiddle::TYPE_VOIDP,  # cal : void**
    Fiddle::TYPE_VOIDP,  # pErrorCode : UErrorCode* in/out
  ],
  Fiddle::TYPE_DOUBLE, Fiddle::Function::CDECL)
#[link(name = "icuin")]
extern "C" {
    fn ucal_getGregorianChange(
        cal: *const *const (),  // void**
        pErrorCode: *mut i32  // UErrorCode* in/out
    ) -> f64;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern double ucal_getGregorianChange(IntPtr cal, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_ucal_getGregorianChange' -Namespace Win32 -PassThru
# $api::ucal_getGregorianChange(cal, pErrorCode)
#uselib "icuin.dll"
#func global ucal_getGregorianChange "ucal_getGregorianChange" sptr, sptr
; ucal_getGregorianChange cal, pErrorCode   ; 戻り値は stat
; cal : void** -> "sptr"
; pErrorCode : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "icuin.dll"
#cfunc global ucal_getGregorianChange "ucal_getGregorianChange" sptr, int
; res = ucal_getGregorianChange(cal, pErrorCode)
; cal : void** -> "sptr"
; pErrorCode : UErrorCode* in/out -> "int"
; DOUBLE ucal_getGregorianChange(void** cal, UErrorCode* pErrorCode)
#uselib "icuin.dll"
#cfunc global ucal_getGregorianChange "ucal_getGregorianChange" intptr, int
; res = ucal_getGregorianChange(cal, pErrorCode)
; cal : void** -> "intptr"
; pErrorCode : UErrorCode* in/out -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procucal_getGregorianChange = icuin.NewProc("ucal_getGregorianChange")
)

// cal (void**), pErrorCode (UErrorCode* in/out)
r1, _, err := procucal_getGregorianChange.Call(
	uintptr(cal),
	uintptr(pErrorCode),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DOUBLE
function ucal_getGregorianChange(
  cal: Pointer;   // void**
  pErrorCode: Pointer   // UErrorCode* in/out
): Double; cdecl;
  external 'icuin.dll' name 'ucal_getGregorianChange';
result := DllCall("icuin\ucal_getGregorianChange"
    , "Ptr", cal   ; void**
    , "Ptr", pErrorCode   ; UErrorCode* in/out
    , "Cdecl Double")   ; return: DOUBLE
●ucal_getGregorianChange(cal, pErrorCode) = DLL("icuin.dll", "double ucal_getGregorianChange(void*, void*)")
# 呼び出し: ucal_getGregorianChange(cal, pErrorCode)
# cal : void** -> "void*"
# pErrorCode : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。