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

u_memcasecmp

関数
大文字小文字を無視して指定長の領域を比較する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

INT u_memcasecmp(
    const WORD* s1,
    const WORD* s2,
    INT length,
    DWORD options
);

パラメーター

名前方向
s1WORD*in
s2WORD*in
lengthINTin
optionsDWORDin

戻り値の型: INT

各言語での呼び出し定義

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

INT u_memcasecmp(
    const WORD* s1,
    const WORD* s2,
    INT length,
    DWORD options
);
[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int u_memcasecmp(
    ref ushort s1,   // WORD*
    ref ushort s2,   // WORD*
    int length,   // INT
    uint options   // DWORD
);
<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function u_memcasecmp(
    ByRef s1 As UShort,   ' WORD*
    ByRef s2 As UShort,   ' WORD*
    length As Integer,   ' INT
    options As UInteger   ' DWORD
) As Integer
End Function
' s1 : WORD*
' s2 : WORD*
' length : INT
' options : DWORD
Declare PtrSafe Function u_memcasecmp Lib "icuuc" ( _
    ByRef s1 As Integer, _
    ByRef s2 As Integer, _
    ByVal length As Long, _
    ByVal options As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

u_memcasecmp = ctypes.cdll.icuuc.u_memcasecmp
u_memcasecmp.restype = ctypes.c_int
u_memcasecmp.argtypes = [
    ctypes.POINTER(ctypes.c_ushort),  # s1 : WORD*
    ctypes.POINTER(ctypes.c_ushort),  # s2 : WORD*
    ctypes.c_int,  # length : INT
    wintypes.DWORD,  # options : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
u_memcasecmp = Fiddle::Function.new(
  lib['u_memcasecmp'],
  [
    Fiddle::TYPE_VOIDP,  # s1 : WORD*
    Fiddle::TYPE_VOIDP,  # s2 : WORD*
    Fiddle::TYPE_INT,  # length : INT
    -Fiddle::TYPE_INT,  # options : DWORD
  ],
  Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn u_memcasecmp(
        s1: *const u16,  // WORD*
        s2: *const u16,  // WORD*
        length: i32,  // INT
        options: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int u_memcasecmp(ref ushort s1, ref ushort s2, int length, uint options);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_u_memcasecmp' -Namespace Win32 -PassThru
# $api::u_memcasecmp(s1, s2, length, options)
#uselib "icuuc.dll"
#func global u_memcasecmp "u_memcasecmp" sptr, sptr, sptr, sptr
; u_memcasecmp varptr(s1), varptr(s2), length, options   ; 戻り値は stat
; s1 : WORD* -> "sptr"
; s2 : WORD* -> "sptr"
; length : INT -> "sptr"
; options : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icuuc.dll"
#cfunc global u_memcasecmp "u_memcasecmp" var, var, int, int
; res = u_memcasecmp(s1, s2, length, options)
; s1 : WORD* -> "var"
; s2 : WORD* -> "var"
; length : INT -> "int"
; options : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT u_memcasecmp(WORD* s1, WORD* s2, INT length, DWORD options)
#uselib "icuuc.dll"
#cfunc global u_memcasecmp "u_memcasecmp" var, var, int, int
; res = u_memcasecmp(s1, s2, length, options)
; s1 : WORD* -> "var"
; s2 : WORD* -> "var"
; length : INT -> "int"
; options : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procu_memcasecmp = icuuc.NewProc("u_memcasecmp")
)

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