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

uloc_getDefault

関数
ICUの既定ロケールIDを取得する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

LPSTR uloc_getDefault(void);

パラメーターなし。戻り値: LPSTR

各言語での呼び出し定義

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

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

uloc_getDefault = ctypes.cdll.icuuc.uloc_getDefault
uloc_getDefault.restype = wintypes.LPSTR
uloc_getDefault.argtypes = []
require 'fiddle'
require 'fiddle/import'

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

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	proculoc_getDefault = icuuc.NewProc("uloc_getDefault")
)

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