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

ucal_setGregorianChange

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

シグネチャ

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

void ucal_setGregorianChange(
    void** cal,
    DOUBLE date,
    UErrorCode* pErrorCode
);

パラメーター

名前方向
calvoid**inout
dateDOUBLEin
pErrorCodeUErrorCode*inout

戻り値の型: void

各言語での呼び出し定義

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

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

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

lib = Fiddle.dlopen('icuin.dll')
ucal_setGregorianChange = Fiddle::Function.new(
  lib['ucal_setGregorianChange'],
  [
    Fiddle::TYPE_VOIDP,  # cal : void** in/out
    Fiddle::TYPE_DOUBLE,  # date : DOUBLE
    Fiddle::TYPE_VOIDP,  # pErrorCode : UErrorCode* in/out
  ],
  Fiddle::TYPE_VOID, Fiddle::Function::CDECL)
#[link(name = "icuin")]
extern "C" {
    fn ucal_setGregorianChange(
        cal: *mut *mut (),  // void** in/out
        date: f64,  // DOUBLE
        pErrorCode: *mut i32  // UErrorCode* in/out
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void ucal_setGregorianChange(IntPtr cal, double date, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_ucal_setGregorianChange' -Namespace Win32 -PassThru
# $api::ucal_setGregorianChange(cal, date, pErrorCode)
#uselib "icuin.dll"
#func global ucal_setGregorianChange "ucal_setGregorianChange" sptr, double, sptr
; ucal_setGregorianChange cal, date, pErrorCode
; cal : void** in/out -> "sptr"
; date : DOUBLE -> "double"
; pErrorCode : UErrorCode* in/out -> "sptr"
#uselib "icuin.dll"
#func global ucal_setGregorianChange "ucal_setGregorianChange" sptr, double, int
; ucal_setGregorianChange cal, date, pErrorCode
; cal : void** in/out -> "sptr"
; date : DOUBLE -> "double"
; pErrorCode : UErrorCode* in/out -> "int"
; void ucal_setGregorianChange(void** cal, DOUBLE date, UErrorCode* pErrorCode)
#uselib "icuin.dll"
#func global ucal_setGregorianChange "ucal_setGregorianChange" intptr, double, int
; ucal_setGregorianChange cal, date, pErrorCode
; cal : void** in/out -> "intptr"
; date : DOUBLE -> "double"
; pErrorCode : UErrorCode* in/out -> "int"
import (
	"math"
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procucal_setGregorianChange = icuin.NewProc("ucal_setGregorianChange")
)

// cal (void** in/out), date (DOUBLE), pErrorCode (UErrorCode* in/out)
r1, _, err := procucal_setGregorianChange.Call(
	uintptr(cal),
	uintptr(math.Float64bits(date)),
	uintptr(pErrorCode),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
// 注意: float/double 引数は proc.Call では XMM レジスタに渡せません。
// windows.SyscallN(proc.Addr(), math.Float64bits(x), ...) もしくは cgo を使用してください。
procedure ucal_setGregorianChange(
  cal: Pointer;   // void** in/out
  date: Double;   // DOUBLE
  pErrorCode: Pointer   // UErrorCode* in/out
); cdecl;
  external 'icuin.dll' name 'ucal_setGregorianChange';
result := DllCall("icuin\ucal_setGregorianChange"
    , "Ptr", cal   ; void** in/out
    , "Double", date   ; DOUBLE
    , "Ptr", pErrorCode   ; UErrorCode* in/out
    , "Cdecl Int")   ; return: void
●ucal_setGregorianChange(cal, date, pErrorCode) = DLL("icuin.dll", "int ucal_setGregorianChange(void*, double, void*)")
# 呼び出し: ucal_setGregorianChange(cal, date, pErrorCode)
# cal : void** in/out -> "void*"
# date : DOUBLE -> "double"
# pErrorCode : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。