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

uset_openEmpty

関数
空のUnicode集合(USet)を新規に生成する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

USet* uset_openEmpty(void);

パラメーターなし。戻り値: USet*

各言語での呼び出し定義

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

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

uset_openEmpty = ctypes.cdll.icuuc.uset_openEmpty
uset_openEmpty.restype = ctypes.c_void_p
uset_openEmpty.argtypes = []
require 'fiddle'
require 'fiddle/import'

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

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procuset_openEmpty = icuuc.NewProc("uset_openEmpty")
)

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

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

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

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

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

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