ホーム › Globalization › uregex_close
uregex_close
関数正規表現オブジェクトを破棄して解放する。
シグネチャ
// icuin.dll
#include <windows.h>
void uregex_close(
URegularExpression* regexp
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| regexp | URegularExpression* | inout | 解放対象の正規表現オブジェクト。uregex_open系で生成したインスタンスを指す。NULL可。 |
戻り値の型: void
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
void uregex_close(
URegularExpression* regexp
);[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern void uregex_close(
ref IntPtr regexp // URegularExpression* in/out
);<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Sub uregex_close(
ByRef regexp As IntPtr ' URegularExpression* in/out
)
End Sub' regexp : URegularExpression* in/out
Declare PtrSafe Sub uregex_close Lib "icuin" ( _
ByRef regexp As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
uregex_close = ctypes.cdll.icuin.uregex_close
uregex_close.restype = None
uregex_close.argtypes = [
ctypes.c_void_p, # regexp : URegularExpression* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuin.dll')
uregex_close = Fiddle::Function.new(
lib['uregex_close'],
[
Fiddle::TYPE_VOIDP, # regexp : URegularExpression* in/out
],
Fiddle::TYPE_VOID, Fiddle::Function::CDECL)#[link(name = "icuin")]
extern "C" {
fn uregex_close(
regexp: *mut isize // URegularExpression* in/out
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void uregex_close(ref IntPtr regexp);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_uregex_close' -Namespace Win32 -PassThru
# $api::uregex_close(regexp)#uselib "icuin.dll"
#func global uregex_close "uregex_close" sptr
; uregex_close varptr(regexp)
; regexp : URegularExpression* in/out -> "sptr"出力引数:
#uselib "icuin.dll" #func global uregex_close "uregex_close" var ; uregex_close regexp ; regexp : URegularExpression* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuin.dll" #func global uregex_close "uregex_close" sptr ; uregex_close varptr(regexp) ; regexp : URegularExpression* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; void uregex_close(URegularExpression* regexp) #uselib "icuin.dll" #func global uregex_close "uregex_close" var ; uregex_close regexp ; regexp : URegularExpression* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; void uregex_close(URegularExpression* regexp) #uselib "icuin.dll" #func global uregex_close "uregex_close" intptr ; uregex_close varptr(regexp) ; regexp : URegularExpression* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuin = windows.NewLazySystemDLL("icuin.dll")
procuregex_close = icuin.NewProc("uregex_close")
)
// regexp (URegularExpression* in/out)
r1, _, err := procuregex_close.Call(
uintptr(regexp),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure uregex_close(
regexp: Pointer // URegularExpression* in/out
); cdecl;
external 'icuin.dll' name 'uregex_close';result := DllCall("icuin\uregex_close"
, "Ptr", regexp ; URegularExpression* in/out
, "Cdecl Int") ; return: void●uregex_close(regexp) = DLL("icuin.dll", "int uregex_close(void*)")
# 呼び出し: uregex_close(regexp)
# regexp : URegularExpression* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。const std = @import("std");
extern "icuin" fn uregex_close(
regexp: [*c]isize // URegularExpression* in/out
) callconv(.c) void;proc uregex_close(
regexp: ptr int # URegularExpression* in/out
) {.importc: "uregex_close", cdecl, dynlib: "icuin.dll".}pragma(lib, "icuin");
extern(C)
void uregex_close(
ptrdiff_t* regexp // URegularExpression* in/out
);ccall((:uregex_close, "icuin.dll"), Cvoid,
(Ptr{Int},),
regexp)
# regexp : URegularExpression* in/out -> Ptr{Int}local ffi = require("ffi")
ffi.cdef[[
void uregex_close(
intptr_t* regexp);
]]
local icuin = ffi.load("icuin")
-- icuin.uregex_close(regexp)
-- regexp : URegularExpression* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icuin.dll');
const uregex_close = lib.func('__cdecl', 'uregex_close', 'void', ['intptr_t *']);
// uregex_close(regexp)
// regexp : URegularExpression* in/out -> 'intptr_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("icuin.dll", {
uregex_close: { parameters: ["pointer"], result: "void" },
});
// lib.symbols.uregex_close(regexp)
// regexp : URegularExpression* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void uregex_close(
intptr_t* regexp);
C, "icuin.dll");
// $ffi->uregex_close(regexp);
// regexp : URegularExpression* in/out
// 構造体/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);
void uregex_close(
LongByReference regexp // URegularExpression* in/out
);
}@[Link("icuin")]
lib Libicuin
fun uregex_close = uregex_close(
regexp : LibC::SSizeT* # URegularExpression* in/out
) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef uregex_closeNative = Void Function(Pointer<IntPtr>);
typedef uregex_closeDart = void Function(Pointer<IntPtr>);
final uregex_close = DynamicLibrary.open('icuin.dll')
.lookupFunction<uregex_closeNative, uregex_closeDart>('uregex_close');
// regexp : URegularExpression* in/out -> Pointer<IntPtr>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
procedure uregex_close(
regexp: Pointer // URegularExpression* in/out
); cdecl;
external 'icuin.dll' name 'uregex_close';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "uregex_close"
c_uregex_close :: Ptr CIntPtr -> IO ()
-- regexp : URegularExpression* in/out -> Ptr CIntPtr
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let uregex_close =
foreign "uregex_close"
((ptr intptr_t) @-> returning void)
(* regexp : URegularExpression* in/out -> (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 ("uregex_close" uregex-close :convention :cdecl) :void
(regexp :pointer)) ; URegularExpression* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $uregex_close = Win32::API::More->new('icuin',
'void uregex_close(LPVOID regexp)');
# my $ret = $uregex_close->Call($regexp);
# regexp : URegularExpression* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。