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

ucsdet_getLanguage

関数
文字セット判定結果の言語を取得する。
DLLicuin.dll呼出規約cdecl

シグネチャ

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

LPSTR ucsdet_getLanguage(
    const UCharsetMatch* ucsm,
    UErrorCode* status
);

パラメーター

名前方向
ucsmUCharsetMatch*in
statusUErrorCode*inout

戻り値の型: LPSTR

各言語での呼び出し定義

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

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

ucsdet_getLanguage = ctypes.cdll.icuin.ucsdet_getLanguage
ucsdet_getLanguage.restype = wintypes.LPSTR
ucsdet_getLanguage.argtypes = [
    ctypes.c_void_p,  # ucsm : UCharsetMatch*
    ctypes.c_void_p,  # status : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procucsdet_getLanguage = icuin.NewProc("ucsdet_getLanguage")
)

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