ホーム › Globalization › ucnv_compareNames
ucnv_compareNames
関数2つの変換器名を正規化して比較する。
シグネチャ
// icuuc.dll
#include <windows.h>
INT ucnv_compareNames(
LPCSTR name1,
LPCSTR name2
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| name1 | LPCSTR | in |
| name2 | LPCSTR | in |
戻り値の型: INT
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
INT ucnv_compareNames(
LPCSTR name1,
LPCSTR name2
);[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int ucnv_compareNames(
[MarshalAs(UnmanagedType.LPStr)] string name1, // LPCSTR
[MarshalAs(UnmanagedType.LPStr)] string name2 // LPCSTR
);<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ucnv_compareNames(
<MarshalAs(UnmanagedType.LPStr)> name1 As String, ' LPCSTR
<MarshalAs(UnmanagedType.LPStr)> name2 As String ' LPCSTR
) As Integer
End Function' name1 : LPCSTR
' name2 : LPCSTR
Declare PtrSafe Function ucnv_compareNames Lib "icuuc" ( _
ByVal name1 As String, _
ByVal name2 As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ucnv_compareNames = ctypes.cdll.icuuc.ucnv_compareNames
ucnv_compareNames.restype = ctypes.c_int
ucnv_compareNames.argtypes = [
wintypes.LPCSTR, # name1 : LPCSTR
wintypes.LPCSTR, # name2 : LPCSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuuc.dll')
ucnv_compareNames = Fiddle::Function.new(
lib['ucnv_compareNames'],
[
Fiddle::TYPE_VOIDP, # name1 : LPCSTR
Fiddle::TYPE_VOIDP, # name2 : LPCSTR
],
Fiddle::TYPE_INT, Fiddle::Function::CDECL)#[link(name = "icuuc")]
extern "C" {
fn ucnv_compareNames(
name1: *const u8, // LPCSTR
name2: *const u8 // LPCSTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int ucnv_compareNames([MarshalAs(UnmanagedType.LPStr)] string name1, [MarshalAs(UnmanagedType.LPStr)] string name2);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_ucnv_compareNames' -Namespace Win32 -PassThru
# $api::ucnv_compareNames(name1, name2)#uselib "icuuc.dll"
#func global ucnv_compareNames "ucnv_compareNames" sptr, sptr
; ucnv_compareNames name1, name2 ; 戻り値は stat
; name1 : LPCSTR -> "sptr"
; name2 : LPCSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "icuuc.dll"
#cfunc global ucnv_compareNames "ucnv_compareNames" str, str
; res = ucnv_compareNames(name1, name2)
; name1 : LPCSTR -> "str"
; name2 : LPCSTR -> "str"; INT ucnv_compareNames(LPCSTR name1, LPCSTR name2)
#uselib "icuuc.dll"
#cfunc global ucnv_compareNames "ucnv_compareNames" str, str
; res = ucnv_compareNames(name1, name2)
; name1 : LPCSTR -> "str"
; name2 : LPCSTR -> "str"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuuc = windows.NewLazySystemDLL("icuuc.dll")
procucnv_compareNames = icuuc.NewProc("ucnv_compareNames")
)
// name1 (LPCSTR), name2 (LPCSTR)
r1, _, err := procucnv_compareNames.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(name1))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(name2))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction ucnv_compareNames(
name1: PAnsiChar; // LPCSTR
name2: PAnsiChar // LPCSTR
): Integer; cdecl;
external 'icuuc.dll' name 'ucnv_compareNames';result := DllCall("icuuc\ucnv_compareNames"
, "AStr", name1 ; LPCSTR
, "AStr", name2 ; LPCSTR
, "Cdecl Int") ; return: INT●ucnv_compareNames(name1, name2) = DLL("icuuc.dll", "int ucnv_compareNames(char*, char*)")
# 呼び出し: ucnv_compareNames(name1, name2)
# name1 : LPCSTR -> "char*"
# name2 : LPCSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。