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