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

ucal_getAttribute

関数
カレンダーの属性値を取得する。
DLLicuin.dll呼出規約cdecl

シグネチャ

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

INT ucal_getAttribute(
    const void** cal,
    UCalendarAttribute attr
);

パラメーター

名前方向
calvoid**in
attrUCalendarAttributein

戻り値の型: INT

各言語での呼び出し定義

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

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

ucal_getAttribute = ctypes.cdll.icuin.ucal_getAttribute
ucal_getAttribute.restype = ctypes.c_int
ucal_getAttribute.argtypes = [
    ctypes.c_void_p,  # cal : void**
    ctypes.c_int,  # attr : UCalendarAttribute
]
require 'fiddle'
require 'fiddle/import'

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

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procucal_getAttribute = icuin.NewProc("ucal_getAttribute")
)

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