ホーム › Globalization › ucnv_countStandards
ucnv_countStandards
関数ICUが認識する文字コード規格の数を返す。
シグネチャ
// icuuc.dll
#include <windows.h>
WORD ucnv_countStandards(void);パラメーターなし。戻り値: WORD
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
WORD ucnv_countStandards(void);[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern ushort ucnv_countStandards();<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ucnv_countStandards() As UShort
End FunctionDeclare PtrSafe Function ucnv_countStandards Lib "icuuc" () As Integer
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ucnv_countStandards = ctypes.cdll.icuuc.ucnv_countStandards
ucnv_countStandards.restype = ctypes.c_ushort
ucnv_countStandards.argtypes = []require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuuc.dll')
ucnv_countStandards = Fiddle::Function.new(
lib['ucnv_countStandards'],
[],
-Fiddle::TYPE_SHORT, Fiddle::Function::CDECL)#[link(name = "icuuc")]
extern "C" {
fn ucnv_countStandards() -> u16;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern ushort ucnv_countStandards();
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_ucnv_countStandards' -Namespace Win32 -PassThru
# $api::ucnv_countStandards()#uselib "icuuc.dll"
#func global ucnv_countStandards "ucnv_countStandards"
; ucnv_countStandards ; 戻り値は stat
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "icuuc.dll"
#cfunc global ucnv_countStandards "ucnv_countStandards"
; res = ucnv_countStandards(); WORD ucnv_countStandards()
#uselib "icuuc.dll"
#cfunc global ucnv_countStandards "ucnv_countStandards"
; res = ucnv_countStandards()import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuuc = windows.NewLazySystemDLL("icuuc.dll")
procucnv_countStandards = icuuc.NewProc("ucnv_countStandards")
)
r1, _, err := procucnv_countStandards.Call()
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // WORDfunction ucnv_countStandards: Word; cdecl;
external 'icuuc.dll' name 'ucnv_countStandards';result := DllCall("icuuc\ucnv_countStandards", "Cdecl UShort")●ucnv_countStandards() = DLL("icuuc.dll", "int ucnv_countStandards()")
# 呼び出し: ucnv_countStandards()
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。const std = @import("std");
extern "icuuc" fn ucnv_countStandards() callconv(.c) u16;proc ucnv_countStandards(): uint16 {.importc: "ucnv_countStandards", cdecl, dynlib: "icuuc.dll".}pragma(lib, "icuuc");
extern(C)
ushort ucnv_countStandards();ccall((:ucnv_countStandards, "icuuc.dll"), UInt16,
(),
)local ffi = require("ffi")
ffi.cdef[[
uint16_t ucnv_countStandards(void);
]]
local icuuc = ffi.load("icuuc")
-- icuuc.ucnv_countStandards()
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icuuc.dll');
const ucnv_countStandards = lib.func('__cdecl', 'ucnv_countStandards', 'uint16_t', []);
// ucnv_countStandards()
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("icuuc.dll", {
ucnv_countStandards: { parameters: [], result: "u16" },
});
// lib.symbols.ucnv_countStandards()
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint16_t ucnv_countStandards(void);
C, "icuuc.dll");
// $ffi->ucnv_countStandards();
// 構造体/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);
short ucnv_countStandards();
}@[Link("icuuc")]
lib Libicuuc
fun ucnv_countStandards = ucnv_countStandards() : UInt16
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ucnv_countStandardsNative = Uint16 Function();
typedef ucnv_countStandardsDart = int Function();
final ucnv_countStandards = DynamicLibrary.open('icuuc.dll')
.lookupFunction<ucnv_countStandardsNative, ucnv_countStandardsDart>('ucnv_countStandards');
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ucnv_countStandards: Word; cdecl;
external 'icuuc.dll' name 'ucnv_countStandards';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "ucnv_countStandards"
c_ucnv_countStandards :: IO Word16
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let ucnv_countstandards =
foreign "ucnv_countStandards"
(void @-> returning uint16_t)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library icuuc (t "icuuc.dll"))
(cffi:use-foreign-library icuuc)
(cffi:defcfun ("ucnv_countStandards" ucnv-count-standards :convention :cdecl) :uint16)
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ucnv_countStandards = Win32::API::More->new('icuuc',
'WORD ucnv_countStandards()');
# my $ret = $ucnv_countStandards->Call();
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。