ホーム › Globalization › udat_getAvailable
udat_getAvailable
関数利用可能なロケールを索引で取得する。
シグネチャ
// icuin.dll
#include <windows.h>
LPSTR udat_getAvailable(
INT localeIndex
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| localeIndex | INT | in | 利用可能ロケール一覧から取得する0始まりのインデックス。 |
戻り値の型: LPSTR
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
LPSTR udat_getAvailable(
INT localeIndex
);[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr udat_getAvailable(
int localeIndex // INT
);<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function udat_getAvailable(
localeIndex As Integer ' INT
) As IntPtr
End Function' localeIndex : INT
Declare PtrSafe Function udat_getAvailable Lib "icuin" ( _
ByVal localeIndex As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
udat_getAvailable = ctypes.cdll.icuin.udat_getAvailable
udat_getAvailable.restype = wintypes.LPSTR
udat_getAvailable.argtypes = [
ctypes.c_int, # localeIndex : INT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuin.dll')
udat_getAvailable = Fiddle::Function.new(
lib['udat_getAvailable'],
[
Fiddle::TYPE_INT, # localeIndex : INT
],
Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)#[link(name = "icuin")]
extern "C" {
fn udat_getAvailable(
localeIndex: i32 // INT
) -> *mut u8;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr udat_getAvailable(int localeIndex);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_udat_getAvailable' -Namespace Win32 -PassThru
# $api::udat_getAvailable(localeIndex)#uselib "icuin.dll"
#func global udat_getAvailable "udat_getAvailable" sptr
; udat_getAvailable localeIndex ; 戻り値は stat
; localeIndex : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "icuin.dll"
#cfunc global udat_getAvailable "udat_getAvailable" int
; res = udat_getAvailable(localeIndex)
; localeIndex : INT -> "int"; LPSTR udat_getAvailable(INT localeIndex)
#uselib "icuin.dll"
#cfunc global udat_getAvailable "udat_getAvailable" int
; res = udat_getAvailable(localeIndex)
; localeIndex : INT -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuin = windows.NewLazySystemDLL("icuin.dll")
procudat_getAvailable = icuin.NewProc("udat_getAvailable")
)
// localeIndex (INT)
r1, _, err := procudat_getAvailable.Call(
uintptr(localeIndex),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // LPSTRfunction udat_getAvailable(
localeIndex: Integer // INT
): PAnsiChar; cdecl;
external 'icuin.dll' name 'udat_getAvailable';result := DllCall("icuin\udat_getAvailable"
, "Int", localeIndex ; INT
, "Cdecl Ptr") ; return: LPSTR●udat_getAvailable(localeIndex) = DLL("icuin.dll", "char* udat_getAvailable(int)")
# 呼び出し: udat_getAvailable(localeIndex)
# localeIndex : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。const std = @import("std");
extern "icuin" fn udat_getAvailable(
localeIndex: i32 // INT
) callconv(.c) [*c]const u8;proc udat_getAvailable(
localeIndex: int32 # INT
): cstring {.importc: "udat_getAvailable", cdecl, dynlib: "icuin.dll".}pragma(lib, "icuin");
extern(C)
const(char)* udat_getAvailable(
int localeIndex // INT
);ccall((:udat_getAvailable, "icuin.dll"), Cstring,
(Int32,),
localeIndex)
# localeIndex : INT -> Int32local ffi = require("ffi")
ffi.cdef[[
const char* udat_getAvailable(
int32_t localeIndex);
]]
local icuin = ffi.load("icuin")
-- icuin.udat_getAvailable(localeIndex)
-- localeIndex : INT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icuin.dll');
const udat_getAvailable = lib.func('__cdecl', 'udat_getAvailable', 'void *', ['int32_t']);
// udat_getAvailable(localeIndex)
// localeIndex : INT -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("icuin.dll", {
udat_getAvailable: { parameters: ["i32"], result: "pointer" },
});
// lib.symbols.udat_getAvailable(localeIndex)
// localeIndex : INT -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
const char* udat_getAvailable(
int32_t localeIndex);
C, "icuin.dll");
// $ffi->udat_getAvailable(localeIndex);
// localeIndex : INT
// 構造体/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);
Pointer udat_getAvailable(
int localeIndex // INT
);
}@[Link("icuin")]
lib Libicuin
fun udat_getAvailable = udat_getAvailable(
localeIndex : Int32 # INT
) : UInt8*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef udat_getAvailableNative = Pointer<Utf8> Function(Int32);
typedef udat_getAvailableDart = Pointer<Utf8> Function(int);
final udat_getAvailable = DynamicLibrary.open('icuin.dll')
.lookupFunction<udat_getAvailableNative, udat_getAvailableDart>('udat_getAvailable');
// localeIndex : INT -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function udat_getAvailable(
localeIndex: Integer // INT
): PAnsiChar; cdecl;
external 'icuin.dll' name 'udat_getAvailable';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "udat_getAvailable"
c_udat_getAvailable :: Int32 -> IO CString
-- localeIndex : INT -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let udat_getavailable =
foreign "udat_getAvailable"
(int32_t @-> returning string)
(* localeIndex : INT -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library icuin (t "icuin.dll"))
(cffi:use-foreign-library icuin)
(cffi:defcfun ("udat_getAvailable" udat-get-available :convention :cdecl) :string
(locale-index :int32)) ; INT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $udat_getAvailable = Win32::API::More->new('icuin',
'LPSTR udat_getAvailable(int localeIndex)');
# my $ret = $udat_getAvailable->Call($localeIndex);
# localeIndex : INT -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。