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

ucfpos_getField

関数
制約付きフィールド位置のフィールドを取得する。
DLLicu.dll呼出規約cdecl

シグネチャ

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

INT ucfpos_getField(
    const UConstrainedFieldPosition* ucfpos,
    UErrorCode* ec
);

パラメーター

名前方向
ucfposUConstrainedFieldPosition*in
ecUErrorCode*inout

戻り値の型: INT

各言語での呼び出し定義

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

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

ucfpos_getField = ctypes.cdll.icu.ucfpos_getField
ucfpos_getField.restype = ctypes.c_int
ucfpos_getField.argtypes = [
    ctypes.c_void_p,  # ucfpos : UConstrainedFieldPosition*
    ctypes.c_void_p,  # ec : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	icu = windows.NewLazySystemDLL("icu.dll")
	procucfpos_getField = icu.NewProc("ucfpos_getField")
)

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