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

uloc_getISO3Country

関数
ロケールの3文字ISO国コードを取得する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

LPSTR uloc_getISO3Country(
    LPCSTR localeID
);

パラメーター

名前方向
localeIDLPCSTRin

戻り値の型: LPSTR

各言語での呼び出し定義

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

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

uloc_getISO3Country = ctypes.cdll.icuuc.uloc_getISO3Country
uloc_getISO3Country.restype = wintypes.LPSTR
uloc_getISO3Country.argtypes = [
    wintypes.LPCSTR,  # localeID : LPCSTR
]
require 'fiddle'
require 'fiddle/import'

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

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	proculoc_getISO3Country = icuuc.NewProc("uloc_getISO3Country")
)

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