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

uset_open

関数
指定範囲のコードポイントを含むUSetを生成する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

USet* uset_open(
    INT start,
    INT end
);

パラメーター

名前方向説明
startINTin初期範囲の先頭コードポイント(この値を含む)。
endINTin初期範囲の末尾コードポイント(この値を含む)。startより小さいと空集合になる。

戻り値の型: USet*

各言語での呼び出し定義

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

USet* uset_open(
    INT start,
    INT end
);
[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr uset_open(
    int start,   // INT
    int end   // INT
);
<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function uset_open(
    start As Integer,   ' INT
    [end] As Integer   ' INT
) As IntPtr
End Function
' start : INT
' end : INT
Declare PtrSafe Function uset_open Lib "icuuc" ( _
    ByVal start As Long, _
    ByVal end As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

uset_open = ctypes.cdll.icuuc.uset_open
uset_open.restype = ctypes.c_void_p
uset_open.argtypes = [
    ctypes.c_int,  # start : INT
    ctypes.c_int,  # end : INT
]
require 'fiddle'
require 'fiddle/import'

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

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procuset_open = icuuc.NewProc("uset_open")
)

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

extern "icuuc" fn uset_open(
    start: i32, // INT
    end: i32 // INT
) callconv(.c) [*c]isize;
proc uset_open(
    start: int32,  # INT
    `end`: int32  # INT
): ptr int {.importc: "uset_open", cdecl, dynlib: "icuuc.dll".}
pragma(lib, "icuuc");
extern(C)
ptrdiff_t* uset_open(
    int start,   // INT
    int end   // INT
);
ccall((:uset_open, "icuuc.dll"), Ptr{Int},
      (Int32, Int32),
      start, end)
# start : INT -> Int32
# end : INT -> Int32
local ffi = require("ffi")
ffi.cdef[[
intptr_t* uset_open(
    int32_t start,
    int32_t end);
]]
local icuuc = ffi.load("icuuc")
-- icuuc.uset_open(start, end)
-- start : INT
-- end : INT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('icuuc.dll');
const uset_open = lib.func('__cdecl', 'uset_open', 'intptr_t *', ['int32_t', 'int32_t']);
// uset_open(start, end)
// start : INT -> 'int32_t'
// end : INT -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("icuuc.dll", {
  uset_open: { parameters: ["i32", "i32"], result: "pointer" },
});
// lib.symbols.uset_open(start, end)
// start : INT -> "i32"
// end : INT -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
intptr_t* uset_open(
    int32_t start,
    int32_t end);
C, "icuuc.dll");
// $ffi->uset_open(start, end);
// start : INT
// end : INT
// 構造体/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 Icuuc extends Library {
    Icuuc INSTANCE = Native.load("icuuc", Icuuc.class);
    Pointer uset_open(
        int start,   // INT
        int end   // INT
    );
}
@[Link("icuuc")]
lib Libicuuc
  fun uset_open = uset_open(
    start : Int32,   # INT
    end_ : Int32   # INT
  ) : LibC::SSizeT*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef uset_openNative = Pointer<IntPtr> Function(Int32, Int32);
typedef uset_openDart = Pointer<IntPtr> Function(int, int);
final uset_open = DynamicLibrary.open('icuuc.dll')
    .lookupFunction<uset_openNative, uset_openDart>('uset_open');
// start : INT -> Int32
// end : INT -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function uset_open(
  start: Integer;   // INT
  end: Integer   // INT
): Pointer; cdecl;
  external 'icuuc.dll' name 'uset_open';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "uset_open"
  c_uset_open :: Int32 -> Int32 -> IO (Ptr CIntPtr)
-- start : INT -> Int32
-- end : INT -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let uset_open =
  foreign "uset_open"
    (int32_t @-> int32_t @-> returning (ptr intptr_t))
(* start : INT -> int32_t *)
(* end : INT -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library icuuc (t "icuuc.dll"))
(cffi:use-foreign-library icuuc)

(cffi:defcfun ("uset_open" uset-open :convention :cdecl) :pointer
  (start :int32)   ; INT
  (end :int32))   ; INT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $uset_open = Win32::API::More->new('icuuc',
    'LPVOID uset_open(int start, int end)');
# my $ret = $uset_open->Call($start, $end);
# start : INT -> int
# end : INT -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。