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

ucasemap_open

関数
ロケールとオプションを指定して大文字小文字変換マップを開く。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

UCaseMap* ucasemap_open(
    LPCSTR locale,
    DWORD options,
    UErrorCode* pErrorCode
);

パラメーター

名前方向
localeLPCSTRin
optionsDWORDin
pErrorCodeUErrorCode*inout

戻り値の型: UCaseMap*

各言語での呼び出し定義

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

UCaseMap* ucasemap_open(
    LPCSTR locale,
    DWORD options,
    UErrorCode* pErrorCode
);
[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr ucasemap_open(
    [MarshalAs(UnmanagedType.LPStr)] string locale,   // LPCSTR
    uint options,   // DWORD
    ref int pErrorCode   // UErrorCode* in/out
);
<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ucasemap_open(
    <MarshalAs(UnmanagedType.LPStr)> locale As String,   ' LPCSTR
    options As UInteger,   ' DWORD
    ByRef pErrorCode As Integer   ' UErrorCode* in/out
) As IntPtr
End Function
' locale : LPCSTR
' options : DWORD
' pErrorCode : UErrorCode* in/out
Declare PtrSafe Function ucasemap_open Lib "icuuc" ( _
    ByVal locale As String, _
    ByVal options As Long, _
    ByRef pErrorCode As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ucasemap_open = ctypes.cdll.icuuc.ucasemap_open
ucasemap_open.restype = ctypes.c_void_p
ucasemap_open.argtypes = [
    wintypes.LPCSTR,  # locale : LPCSTR
    wintypes.DWORD,  # options : DWORD
    ctypes.c_void_p,  # pErrorCode : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procucasemap_open = icuuc.NewProc("ucasemap_open")
)

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