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

uldn_getLocale

関数
表示名生成に使用するロケールを取得する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

LPSTR uldn_getLocale(
    const ULocaleDisplayNames* ldn
);

パラメーター

名前方向
ldnULocaleDisplayNames*in

戻り値の型: LPSTR

各言語での呼び出し定義

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

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

uldn_getLocale = ctypes.cdll.icuuc.uldn_getLocale
uldn_getLocale.restype = wintypes.LPSTR
uldn_getLocale.argtypes = [
    ctypes.c_void_p,  # ldn : ULocaleDisplayNames*
]
require 'fiddle'
require 'fiddle/import'

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

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	proculdn_getLocale = icuuc.NewProc("uldn_getLocale")
)

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