Win32 API 日本語リファレンス
ホームGlobalization › uloc_getAvailable

uloc_getAvailable

関数
インデックスnで指定した利用可能なロケールIDを取得する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

// icuuc.dll
#include <windows.h>

LPSTR uloc_getAvailable(
    INT n
);

パラメーター

名前方向
nINTin

戻り値の型: LPSTR

各言語での呼び出し定義

// icuuc.dll
#include <windows.h>

LPSTR uloc_getAvailable(
    INT n
);
[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr uloc_getAvailable(
    int n   // INT
);
<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function uloc_getAvailable(
    n As Integer   ' INT
) As IntPtr
End Function
' n : INT
Declare PtrSafe Function uloc_getAvailable Lib "icuuc" ( _
    ByVal n As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

uloc_getAvailable = ctypes.cdll.icuuc.uloc_getAvailable
uloc_getAvailable.restype = wintypes.LPSTR
uloc_getAvailable.argtypes = [
    ctypes.c_int,  # n : INT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
uloc_getAvailable = Fiddle::Function.new(
  lib['uloc_getAvailable'],
  [
    Fiddle::TYPE_INT,  # n : INT
  ],
  Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn uloc_getAvailable(
        n: i32  // INT
    ) -> *mut u8;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr uloc_getAvailable(int n);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_uloc_getAvailable' -Namespace Win32 -PassThru
# $api::uloc_getAvailable(n)
#uselib "icuuc.dll"
#func global uloc_getAvailable "uloc_getAvailable" sptr
; uloc_getAvailable n   ; 戻り値は stat
; n : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "icuuc.dll"
#cfunc global uloc_getAvailable "uloc_getAvailable" int
; res = uloc_getAvailable(n)
; n : INT -> "int"
; LPSTR uloc_getAvailable(INT n)
#uselib "icuuc.dll"
#cfunc global uloc_getAvailable "uloc_getAvailable" int
; res = uloc_getAvailable(n)
; n : INT -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	proculoc_getAvailable = icuuc.NewProc("uloc_getAvailable")
)

// n (INT)
r1, _, err := proculoc_getAvailable.Call(
	uintptr(n),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // LPSTR
function uloc_getAvailable(
  n: Integer   // INT
): PAnsiChar; cdecl;
  external 'icuuc.dll' name 'uloc_getAvailable';
result := DllCall("icuuc\uloc_getAvailable"
    , "Int", n   ; INT
    , "Cdecl Ptr")   ; return: LPSTR
●uloc_getAvailable(n) = DLL("icuuc.dll", "char* uloc_getAvailable(int)")
# 呼び出し: uloc_getAvailable(n)
# n : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。