ホーム › Globalization › utext_nativeLength
utext_nativeLength
関数UTextのネイティブ単位での長さを取得する。
シグネチャ
// icuuc.dll
#include <windows.h>
LONGLONG utext_nativeLength(
UText* ut
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| ut | UText* | inout | ネイティブ単位での全長を取得する対象のUTextオブジェクトへのポインタ。 |
戻り値の型: LONGLONG
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
LONGLONG utext_nativeLength(
UText* ut
);[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern long utext_nativeLength(
IntPtr ut // UText* in/out
);<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function utext_nativeLength(
ut As IntPtr ' UText* in/out
) As Long
End Function' ut : UText* in/out
Declare PtrSafe Function utext_nativeLength Lib "icuuc" ( _
ByVal ut As LongPtr) As LongLong
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
utext_nativeLength = ctypes.cdll.icuuc.utext_nativeLength
utext_nativeLength.restype = ctypes.c_longlong
utext_nativeLength.argtypes = [
ctypes.c_void_p, # ut : UText* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuuc.dll')
utext_nativeLength = Fiddle::Function.new(
lib['utext_nativeLength'],
[
Fiddle::TYPE_VOIDP, # ut : UText* in/out
],
Fiddle::TYPE_LONG_LONG, Fiddle::Function::CDECL)#[link(name = "icuuc")]
extern "C" {
fn utext_nativeLength(
ut: *mut UText // UText* in/out
) -> i64;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern long utext_nativeLength(IntPtr ut);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_utext_nativeLength' -Namespace Win32 -PassThru
# $api::utext_nativeLength(ut)#uselib "icuuc.dll"
#func global utext_nativeLength "utext_nativeLength" sptr
; utext_nativeLength varptr(ut) ; 戻り値は stat
; ut : UText* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuuc.dll" #cfunc global utext_nativeLength "utext_nativeLength" var ; res = utext_nativeLength(ut) ; ut : UText* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuuc.dll" #cfunc global utext_nativeLength "utext_nativeLength" sptr ; res = utext_nativeLength(varptr(ut)) ; ut : UText* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; LONGLONG utext_nativeLength(UText* ut) #uselib "icuuc.dll" #cfunc global utext_nativeLength "utext_nativeLength" var ; res = utext_nativeLength(ut) ; ut : UText* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; LONGLONG utext_nativeLength(UText* ut) #uselib "icuuc.dll" #cfunc global utext_nativeLength "utext_nativeLength" intptr ; res = utext_nativeLength(varptr(ut)) ; ut : UText* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuuc = windows.NewLazySystemDLL("icuuc.dll")
procutext_nativeLength = icuuc.NewProc("utext_nativeLength")
)
// ut (UText* in/out)
r1, _, err := procutext_nativeLength.Call(
uintptr(ut),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // LONGLONGfunction utext_nativeLength(
ut: Pointer // UText* in/out
): Int64; cdecl;
external 'icuuc.dll' name 'utext_nativeLength';result := DllCall("icuuc\utext_nativeLength"
, "Ptr", ut ; UText* in/out
, "Cdecl Int64") ; return: LONGLONG●utext_nativeLength(ut) = DLL("icuuc.dll", "int64 utext_nativeLength(void*)")
# 呼び出し: utext_nativeLength(ut)
# ut : UText* 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 utext_nativeLength(
ut: [*c]UText // UText* in/out
) callconv(.c) i64;proc utext_nativeLength(
ut: ptr UText # UText* in/out
): int64 {.importc: "utext_nativeLength", cdecl, dynlib: "icuuc.dll".}pragma(lib, "icuuc");
extern(C)
long utext_nativeLength(
UText* ut // UText* in/out
);ccall((:utext_nativeLength, "icuuc.dll"), Int64,
(Ptr{UText},),
ut)
# ut : UText* in/out -> Ptr{UText}local ffi = require("ffi")
ffi.cdef[[
int64_t utext_nativeLength(
void* ut);
]]
local icuuc = ffi.load("icuuc")
-- icuuc.utext_nativeLength(ut)
-- ut : UText* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icuuc.dll');
const utext_nativeLength = lib.func('__cdecl', 'utext_nativeLength', 'int64_t', ['void *']);
// utext_nativeLength(ut)
// ut : UText* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("icuuc.dll", {
utext_nativeLength: { parameters: ["pointer"], result: "i64" },
});
// lib.symbols.utext_nativeLength(ut)
// ut : UText* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int64_t utext_nativeLength(
void* ut);
C, "icuuc.dll");
// $ffi->utext_nativeLength(ut);
// ut : UText* 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);
long utext_nativeLength(
Pointer ut // UText* in/out
);
}@[Link("icuuc")]
lib Libicuuc
fun utext_nativeLength = utext_nativeLength(
ut : UText* # UText* in/out
) : Int64
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef utext_nativeLengthNative = Int64 Function(Pointer<Void>);
typedef utext_nativeLengthDart = int Function(Pointer<Void>);
final utext_nativeLength = DynamicLibrary.open('icuuc.dll')
.lookupFunction<utext_nativeLengthNative, utext_nativeLengthDart>('utext_nativeLength');
// ut : UText* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function utext_nativeLength(
ut: Pointer // UText* in/out
): Int64; cdecl;
external 'icuuc.dll' name 'utext_nativeLength';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "utext_nativeLength"
c_utext_nativeLength :: Ptr () -> IO Int64
-- ut : UText* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let utext_nativelength =
foreign "utext_nativeLength"
((ptr void) @-> returning int64_t)
(* ut : UText* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library icuuc (t "icuuc.dll"))
(cffi:use-foreign-library icuuc)
(cffi:defcfun ("utext_nativeLength" utext-native-length :convention :cdecl) :int64
(ut :pointer)) ; UText* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $utext_nativeLength = Win32::API::More->new('icuuc',
'INT64 utext_nativeLength(LPVOID ut)');
# my $ret = $utext_nativeLength->Call($ut);
# ut : UText* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型