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

uldn_languageDisplayName

関数
指定言語コードの表示名を生成して取得する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

INT uldn_languageDisplayName(
    const ULocaleDisplayNames* ldn,
    LPCSTR lang,
    WORD* result,
    INT maxResultSize,
    UErrorCode* pErrorCode
);

パラメーター

名前方向説明
ldnULocaleDisplayNames*in対象のロケール表示名オブジェクト。
langLPCSTRin表示名を求める言語コード。
resultWORD*inout言語の表示名(UTF-16)を格納する出力バッファ。
maxResultSizeINTinresult バッファの容量(UChar単位)。
pErrorCodeUErrorCode*inoutICUエラーコードを受け渡すポインタ。U_ZERO_ERRORへ初期化が必要。

戻り値の型: INT

各言語での呼び出し定義

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

INT uldn_languageDisplayName(
    const ULocaleDisplayNames* ldn,
    LPCSTR lang,
    WORD* result,
    INT maxResultSize,
    UErrorCode* pErrorCode
);
[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int uldn_languageDisplayName(
    ref IntPtr ldn,   // ULocaleDisplayNames*
    [MarshalAs(UnmanagedType.LPStr)] string lang,   // LPCSTR
    ref ushort result,   // WORD* in/out
    int maxResultSize,   // INT
    ref int pErrorCode   // UErrorCode* in/out
);
<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function uldn_languageDisplayName(
    ByRef ldn As IntPtr,   ' ULocaleDisplayNames*
    <MarshalAs(UnmanagedType.LPStr)> lang As String,   ' LPCSTR
    ByRef result As UShort,   ' WORD* in/out
    maxResultSize As Integer,   ' INT
    ByRef pErrorCode As Integer   ' UErrorCode* in/out
) As Integer
End Function
' ldn : ULocaleDisplayNames*
' lang : LPCSTR
' result : WORD* in/out
' maxResultSize : INT
' pErrorCode : UErrorCode* in/out
Declare PtrSafe Function uldn_languageDisplayName Lib "icuuc" ( _
    ByRef ldn As LongPtr, _
    ByVal lang As String, _
    ByRef result As Integer, _
    ByVal maxResultSize As Long, _
    ByRef pErrorCode As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

uldn_languageDisplayName = ctypes.cdll.icuuc.uldn_languageDisplayName
uldn_languageDisplayName.restype = ctypes.c_int
uldn_languageDisplayName.argtypes = [
    ctypes.c_void_p,  # ldn : ULocaleDisplayNames*
    wintypes.LPCSTR,  # lang : LPCSTR
    ctypes.POINTER(ctypes.c_ushort),  # result : WORD* in/out
    ctypes.c_int,  # maxResultSize : INT
    ctypes.c_void_p,  # pErrorCode : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
uldn_languageDisplayName = Fiddle::Function.new(
  lib['uldn_languageDisplayName'],
  [
    Fiddle::TYPE_VOIDP,  # ldn : ULocaleDisplayNames*
    Fiddle::TYPE_VOIDP,  # lang : LPCSTR
    Fiddle::TYPE_VOIDP,  # result : WORD* in/out
    Fiddle::TYPE_INT,  # maxResultSize : INT
    Fiddle::TYPE_VOIDP,  # pErrorCode : UErrorCode* in/out
  ],
  Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn uldn_languageDisplayName(
        ldn: *const isize,  // ULocaleDisplayNames*
        lang: *const u8,  // LPCSTR
        result: *mut u16,  // WORD* in/out
        maxResultSize: i32,  // INT
        pErrorCode: *mut i32  // UErrorCode* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int uldn_languageDisplayName(ref IntPtr ldn, [MarshalAs(UnmanagedType.LPStr)] string lang, ref ushort result, int maxResultSize, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_uldn_languageDisplayName' -Namespace Win32 -PassThru
# $api::uldn_languageDisplayName(ldn, lang, result, maxResultSize, pErrorCode)
#uselib "icuuc.dll"
#func global uldn_languageDisplayName "uldn_languageDisplayName" sptr, sptr, sptr, sptr, sptr
; uldn_languageDisplayName varptr(ldn), lang, varptr(result), maxResultSize, varptr(pErrorCode)   ; 戻り値は stat
; ldn : ULocaleDisplayNames* -> "sptr"
; lang : LPCSTR -> "sptr"
; result : WORD* in/out -> "sptr"
; maxResultSize : INT -> "sptr"
; pErrorCode : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icuuc.dll"
#cfunc global uldn_languageDisplayName "uldn_languageDisplayName" var, str, var, int, var
; res = uldn_languageDisplayName(ldn, lang, result, maxResultSize, pErrorCode)
; ldn : ULocaleDisplayNames* -> "var"
; lang : LPCSTR -> "str"
; result : WORD* in/out -> "var"
; maxResultSize : INT -> "int"
; pErrorCode : UErrorCode* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT uldn_languageDisplayName(ULocaleDisplayNames* ldn, LPCSTR lang, WORD* result, INT maxResultSize, UErrorCode* pErrorCode)
#uselib "icuuc.dll"
#cfunc global uldn_languageDisplayName "uldn_languageDisplayName" var, str, var, int, var
; res = uldn_languageDisplayName(ldn, lang, result, maxResultSize, pErrorCode)
; ldn : ULocaleDisplayNames* -> "var"
; lang : LPCSTR -> "str"
; result : WORD* in/out -> "var"
; maxResultSize : INT -> "int"
; pErrorCode : UErrorCode* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	proculdn_languageDisplayName = icuuc.NewProc("uldn_languageDisplayName")
)

// ldn (ULocaleDisplayNames*), lang (LPCSTR), result (WORD* in/out), maxResultSize (INT), pErrorCode (UErrorCode* in/out)
r1, _, err := proculdn_languageDisplayName.Call(
	uintptr(ldn),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(lang))),
	uintptr(result),
	uintptr(maxResultSize),
	uintptr(pErrorCode),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function uldn_languageDisplayName(
  ldn: Pointer;   // ULocaleDisplayNames*
  lang: PAnsiChar;   // LPCSTR
  result: Pointer;   // WORD* in/out
  maxResultSize: Integer;   // INT
  pErrorCode: Pointer   // UErrorCode* in/out
): Integer; cdecl;
  external 'icuuc.dll' name 'uldn_languageDisplayName';
result := DllCall("icuuc\uldn_languageDisplayName"
    , "Ptr", ldn   ; ULocaleDisplayNames*
    , "AStr", lang   ; LPCSTR
    , "Ptr", result   ; WORD* in/out
    , "Int", maxResultSize   ; INT
    , "Ptr", pErrorCode   ; UErrorCode* in/out
    , "Cdecl Int")   ; return: INT
●uldn_languageDisplayName(ldn, lang, result, maxResultSize, pErrorCode) = DLL("icuuc.dll", "int uldn_languageDisplayName(void*, char*, void*, int, void*)")
# 呼び出し: uldn_languageDisplayName(ldn, lang, result, maxResultSize, pErrorCode)
# ldn : ULocaleDisplayNames* -> "void*"
# lang : LPCSTR -> "char*"
# result : WORD* in/out -> "void*"
# maxResultSize : INT -> "int"
# pErrorCode : UErrorCode* 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 uldn_languageDisplayName(
    ldn: [*c]isize, // ULocaleDisplayNames*
    lang: [*c]const u8, // LPCSTR
    result: [*c]u16, // WORD* in/out
    maxResultSize: i32, // INT
    pErrorCode: [*c]i32 // UErrorCode* in/out
) callconv(.c) i32;
proc uldn_languageDisplayName(
    ldn: ptr int,  # ULocaleDisplayNames*
    lang: cstring,  # LPCSTR
    result: ptr uint16,  # WORD* in/out
    maxResultSize: int32,  # INT
    pErrorCode: ptr int32  # UErrorCode* in/out
): int32 {.importc: "uldn_languageDisplayName", cdecl, dynlib: "icuuc.dll".}
pragma(lib, "icuuc");
extern(C)
int uldn_languageDisplayName(
    ptrdiff_t* ldn,   // ULocaleDisplayNames*
    const(char)* lang,   // LPCSTR
    ushort* result,   // WORD* in/out
    int maxResultSize,   // INT
    int* pErrorCode   // UErrorCode* in/out
);
ccall((:uldn_languageDisplayName, "icuuc.dll"), Int32,
      (Ptr{Int}, Cstring, Ptr{UInt16}, Int32, Ptr{Int32}),
      ldn, lang, result, maxResultSize, pErrorCode)
# ldn : ULocaleDisplayNames* -> Ptr{Int}
# lang : LPCSTR -> Cstring
# result : WORD* in/out -> Ptr{UInt16}
# maxResultSize : INT -> Int32
# pErrorCode : UErrorCode* in/out -> Ptr{Int32}
local ffi = require("ffi")
ffi.cdef[[
int32_t uldn_languageDisplayName(
    intptr_t* ldn,
    const char* lang,
    uint16_t* result,
    int32_t maxResultSize,
    int32_t* pErrorCode);
]]
local icuuc = ffi.load("icuuc")
-- icuuc.uldn_languageDisplayName(ldn, lang, result, maxResultSize, pErrorCode)
-- ldn : ULocaleDisplayNames*
-- lang : LPCSTR
-- result : WORD* in/out
-- maxResultSize : INT
-- pErrorCode : UErrorCode* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('icuuc.dll');
const uldn_languageDisplayName = lib.func('__cdecl', 'uldn_languageDisplayName', 'int32_t', ['intptr_t *', 'str', 'uint16_t *', 'int32_t', 'int32_t *']);
// uldn_languageDisplayName(ldn, lang, result, maxResultSize, pErrorCode)
// ldn : ULocaleDisplayNames* -> 'intptr_t *'
// lang : LPCSTR -> 'str'
// result : WORD* in/out -> 'uint16_t *'
// maxResultSize : INT -> 'int32_t'
// pErrorCode : UErrorCode* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("icuuc.dll", {
  uldn_languageDisplayName: { parameters: ["pointer", "buffer", "pointer", "i32", "pointer"], result: "i32" },
});
// lib.symbols.uldn_languageDisplayName(ldn, lang, result, maxResultSize, pErrorCode)
// ldn : ULocaleDisplayNames* -> "pointer"
// lang : LPCSTR -> "buffer"
// result : WORD* in/out -> "pointer"
// maxResultSize : INT -> "i32"
// pErrorCode : UErrorCode* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t uldn_languageDisplayName(
    intptr_t* ldn,
    const char* lang,
    uint16_t* result,
    int32_t maxResultSize,
    int32_t* pErrorCode);
C, "icuuc.dll");
// $ffi->uldn_languageDisplayName(ldn, lang, result, maxResultSize, pErrorCode);
// ldn : ULocaleDisplayNames*
// lang : LPCSTR
// result : WORD* in/out
// maxResultSize : INT
// pErrorCode : UErrorCode* 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);
    int uldn_languageDisplayName(
        LongByReference ldn,   // ULocaleDisplayNames*
        String lang,   // LPCSTR
        ShortByReference result,   // WORD* in/out
        int maxResultSize,   // INT
        IntByReference pErrorCode   // UErrorCode* in/out
    );
}
@[Link("icuuc")]
lib Libicuuc
  fun uldn_languageDisplayName = uldn_languageDisplayName(
    ldn : LibC::SSizeT*,   # ULocaleDisplayNames*
    lang : UInt8*,   # LPCSTR
    result : UInt16*,   # WORD* in/out
    maxResultSize : Int32,   # INT
    pErrorCode : Int32*   # UErrorCode* in/out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef uldn_languageDisplayNameNative = Int32 Function(Pointer<IntPtr>, Pointer<Utf8>, Pointer<Uint16>, Int32, Pointer<Int32>);
typedef uldn_languageDisplayNameDart = int Function(Pointer<IntPtr>, Pointer<Utf8>, Pointer<Uint16>, int, Pointer<Int32>);
final uldn_languageDisplayName = DynamicLibrary.open('icuuc.dll')
    .lookupFunction<uldn_languageDisplayNameNative, uldn_languageDisplayNameDart>('uldn_languageDisplayName');
// ldn : ULocaleDisplayNames* -> Pointer<IntPtr>
// lang : LPCSTR -> Pointer<Utf8>
// result : WORD* in/out -> Pointer<Uint16>
// maxResultSize : INT -> Int32
// pErrorCode : UErrorCode* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function uldn_languageDisplayName(
  ldn: Pointer;   // ULocaleDisplayNames*
  lang: PAnsiChar;   // LPCSTR
  result: Pointer;   // WORD* in/out
  maxResultSize: Integer;   // INT
  pErrorCode: Pointer   // UErrorCode* in/out
): Integer; cdecl;
  external 'icuuc.dll' name 'uldn_languageDisplayName';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "uldn_languageDisplayName"
  c_uldn_languageDisplayName :: Ptr CIntPtr -> CString -> Ptr Word16 -> Int32 -> Ptr Int32 -> IO Int32
-- ldn : ULocaleDisplayNames* -> Ptr CIntPtr
-- lang : LPCSTR -> CString
-- result : WORD* in/out -> Ptr Word16
-- maxResultSize : INT -> Int32
-- pErrorCode : UErrorCode* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let uldn_languagedisplayname =
  foreign "uldn_languageDisplayName"
    ((ptr intptr_t) @-> string @-> (ptr uint16_t) @-> int32_t @-> (ptr int32_t) @-> returning int32_t)
(* ldn : ULocaleDisplayNames* -> (ptr intptr_t) *)
(* lang : LPCSTR -> string *)
(* result : WORD* in/out -> (ptr uint16_t) *)
(* maxResultSize : INT -> int32_t *)
(* pErrorCode : UErrorCode* in/out -> (ptr int32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library icuuc (t "icuuc.dll"))
(cffi:use-foreign-library icuuc)

(cffi:defcfun ("uldn_languageDisplayName" uldn-language-display-name :convention :cdecl) :int32
  (ldn :pointer)   ; ULocaleDisplayNames*
  (lang :string)   ; LPCSTR
  (result :pointer)   ; WORD* in/out
  (max-result-size :int32)   ; INT
  (p-error-code :pointer))   ; UErrorCode* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $uldn_languageDisplayName = Win32::API::More->new('icuuc',
    'int uldn_languageDisplayName(LPVOID ldn, LPCSTR lang, LPVOID result, int maxResultSize, LPVOID pErrorCode)');
# my $ret = $uldn_languageDisplayName->Call($ldn, $lang, $result, $maxResultSize, $pErrorCode);
# ldn : ULocaleDisplayNames* -> LPVOID
# lang : LPCSTR -> LPCSTR
# result : WORD* in/out -> LPVOID
# maxResultSize : INT -> int
# pErrorCode : UErrorCode* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型