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

usearch_getCollator

関数
検索に用いるコレータを取得する。
DLLicuin.dll呼出規約cdecl

シグネチャ

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

UCollator* usearch_getCollator(
    const UStringSearch* strsrch
);

パラメーター

名前方向説明
strsrchUStringSearch*in照合器を取得する対象のUStringSearch検索オブジェクトへのポインター。

戻り値の型: UCollator*

各言語での呼び出し定義

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

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

usearch_getCollator = ctypes.cdll.icuin.usearch_getCollator
usearch_getCollator.restype = ctypes.c_void_p
usearch_getCollator.argtypes = [
    ctypes.c_void_p,  # strsrch : UStringSearch*
]
require 'fiddle'
require 'fiddle/import'

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

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procusearch_getCollator = icuin.NewProc("usearch_getCollator")
)

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

extern "icuin" fn usearch_getCollator(
    strsrch: [*c]isize // UStringSearch*
) callconv(.c) [*c]isize;
proc usearch_getCollator(
    strsrch: ptr int  # UStringSearch*
): ptr int {.importc: "usearch_getCollator", cdecl, dynlib: "icuin.dll".}
pragma(lib, "icuin");
extern(C)
ptrdiff_t* usearch_getCollator(
    ptrdiff_t* strsrch   // UStringSearch*
);
ccall((:usearch_getCollator, "icuin.dll"), Ptr{Int},
      (Ptr{Int},),
      strsrch)
# strsrch : UStringSearch* -> Ptr{Int}
local ffi = require("ffi")
ffi.cdef[[
intptr_t* usearch_getCollator(
    intptr_t* strsrch);
]]
local icuin = ffi.load("icuin")
-- icuin.usearch_getCollator(strsrch)
-- strsrch : UStringSearch*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('icuin.dll');
const usearch_getCollator = lib.func('__cdecl', 'usearch_getCollator', 'intptr_t *', ['intptr_t *']);
// usearch_getCollator(strsrch)
// strsrch : UStringSearch* -> 'intptr_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("icuin.dll", {
  usearch_getCollator: { parameters: ["pointer"], result: "pointer" },
});
// lib.symbols.usearch_getCollator(strsrch)
// strsrch : UStringSearch* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
intptr_t* usearch_getCollator(
    intptr_t* strsrch);
C, "icuin.dll");
// $ffi->usearch_getCollator(strsrch);
// strsrch : UStringSearch*
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Icuin extends Library {
    Icuin INSTANCE = Native.load("icuin", Icuin.class);
    Pointer usearch_getCollator(
        LongByReference strsrch   // UStringSearch*
    );
}
@[Link("icuin")]
lib Libicuin
  fun usearch_getCollator = usearch_getCollator(
    strsrch : LibC::SSizeT*   # UStringSearch*
  ) : LibC::SSizeT*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef usearch_getCollatorNative = Pointer<IntPtr> Function(Pointer<IntPtr>);
typedef usearch_getCollatorDart = Pointer<IntPtr> Function(Pointer<IntPtr>);
final usearch_getCollator = DynamicLibrary.open('icuin.dll')
    .lookupFunction<usearch_getCollatorNative, usearch_getCollatorDart>('usearch_getCollator');
// strsrch : UStringSearch* -> Pointer<IntPtr>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function usearch_getCollator(
  strsrch: Pointer   // UStringSearch*
): Pointer; cdecl;
  external 'icuin.dll' name 'usearch_getCollator';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "usearch_getCollator"
  c_usearch_getCollator :: Ptr CIntPtr -> IO (Ptr CIntPtr)
-- strsrch : UStringSearch* -> Ptr CIntPtr
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let usearch_getcollator =
  foreign "usearch_getCollator"
    ((ptr intptr_t) @-> returning (ptr intptr_t))
(* strsrch : UStringSearch* -> (ptr intptr_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library icuin (t "icuin.dll"))
(cffi:use-foreign-library icuin)

(cffi:defcfun ("usearch_getCollator" usearch-get-collator :convention :cdecl) :pointer
  (strsrch :pointer))   ; UStringSearch*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $usearch_getCollator = Win32::API::More->new('icuin',
    'LPVOID usearch_getCollator(LPVOID strsrch)');
# my $ret = $usearch_getCollator->Call($strsrch);
# strsrch : UStringSearch* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。