ホーム › Globalization › u_strFromJavaModifiedUTF8WithSub
u_strFromJavaModifiedUTF8WithSub
関数Java修正UTF-8を代替しながらUTF-16文字列へ変換する。
シグネチャ
// icuuc.dll
#include <windows.h>
WORD* u_strFromJavaModifiedUTF8WithSub(
WORD* dest,
INT destCapacity,
INT* pDestLength,
LPCSTR src,
INT srcLength,
INT subchar,
INT* pNumSubstitutions,
UErrorCode* pErrorCode
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| dest | WORD* | inout | 変換結果のUTF-16文字列を格納する出力バッファ。NULL可。 |
| destCapacity | INT | in | destの容量をUChar単位で指定する。0で事前長取得。 |
| pDestLength | INT* | inout | 実際に必要な出力長を受け取るポインタ。NULL可。 |
| src | LPCSTR | in | 変換元のJava修正UTF-8文字列を指す。 |
| srcLength | INT | in | srcの長さをバイト単位で指定する。-1でNUL終端。 |
| subchar | INT | in | 不正バイトを置換する符号位置。負値で既定の置換動作。 |
| pNumSubstitutions | INT* | inout | 置換が行われた回数を受け取るポインタ。NULL可。 |
| pErrorCode | UErrorCode* | inout | ICUエラーコードを入出力するポインタ。呼出前に成功値で初期化する。 |
戻り値の型: WORD*
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
WORD* u_strFromJavaModifiedUTF8WithSub(
WORD* dest,
INT destCapacity,
INT* pDestLength,
LPCSTR src,
INT srcLength,
INT subchar,
INT* pNumSubstitutions,
UErrorCode* pErrorCode
);[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr u_strFromJavaModifiedUTF8WithSub(
ref ushort dest, // WORD* in/out
int destCapacity, // INT
ref int pDestLength, // INT* in/out
[MarshalAs(UnmanagedType.LPStr)] string src, // LPCSTR
int srcLength, // INT
int subchar, // INT
ref int pNumSubstitutions, // INT* in/out
ref int pErrorCode // UErrorCode* in/out
);<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function u_strFromJavaModifiedUTF8WithSub(
ByRef dest As UShort, ' WORD* in/out
destCapacity As Integer, ' INT
ByRef pDestLength As Integer, ' INT* in/out
<MarshalAs(UnmanagedType.LPStr)> src As String, ' LPCSTR
srcLength As Integer, ' INT
subchar As Integer, ' INT
ByRef pNumSubstitutions As Integer, ' INT* in/out
ByRef pErrorCode As Integer ' UErrorCode* in/out
) As IntPtr
End Function' dest : WORD* in/out
' destCapacity : INT
' pDestLength : INT* in/out
' src : LPCSTR
' srcLength : INT
' subchar : INT
' pNumSubstitutions : INT* in/out
' pErrorCode : UErrorCode* in/out
Declare PtrSafe Function u_strFromJavaModifiedUTF8WithSub Lib "icuuc" ( _
ByRef dest As Integer, _
ByVal destCapacity As Long, _
ByRef pDestLength As Long, _
ByVal src As String, _
ByVal srcLength As Long, _
ByVal subchar As Long, _
ByRef pNumSubstitutions As Long, _
ByRef pErrorCode As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
u_strFromJavaModifiedUTF8WithSub = ctypes.cdll.icuuc.u_strFromJavaModifiedUTF8WithSub
u_strFromJavaModifiedUTF8WithSub.restype = ctypes.c_void_p
u_strFromJavaModifiedUTF8WithSub.argtypes = [
ctypes.POINTER(ctypes.c_ushort), # dest : WORD* in/out
ctypes.c_int, # destCapacity : INT
ctypes.POINTER(ctypes.c_int), # pDestLength : INT* in/out
wintypes.LPCSTR, # src : LPCSTR
ctypes.c_int, # srcLength : INT
ctypes.c_int, # subchar : INT
ctypes.POINTER(ctypes.c_int), # pNumSubstitutions : INT* in/out
ctypes.c_void_p, # pErrorCode : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuuc.dll')
u_strFromJavaModifiedUTF8WithSub = Fiddle::Function.new(
lib['u_strFromJavaModifiedUTF8WithSub'],
[
Fiddle::TYPE_VOIDP, # dest : WORD* in/out
Fiddle::TYPE_INT, # destCapacity : INT
Fiddle::TYPE_VOIDP, # pDestLength : INT* in/out
Fiddle::TYPE_VOIDP, # src : LPCSTR
Fiddle::TYPE_INT, # srcLength : INT
Fiddle::TYPE_INT, # subchar : INT
Fiddle::TYPE_VOIDP, # pNumSubstitutions : INT* in/out
Fiddle::TYPE_VOIDP, # pErrorCode : UErrorCode* in/out
],
Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)#[link(name = "icuuc")]
extern "C" {
fn u_strFromJavaModifiedUTF8WithSub(
dest: *mut u16, // WORD* in/out
destCapacity: i32, // INT
pDestLength: *mut i32, // INT* in/out
src: *const u8, // LPCSTR
srcLength: i32, // INT
subchar: i32, // INT
pNumSubstitutions: *mut i32, // INT* in/out
pErrorCode: *mut i32 // UErrorCode* in/out
) -> *mut u16;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr u_strFromJavaModifiedUTF8WithSub(ref ushort dest, int destCapacity, ref int pDestLength, [MarshalAs(UnmanagedType.LPStr)] string src, int srcLength, int subchar, ref int pNumSubstitutions, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_u_strFromJavaModifiedUTF8WithSub' -Namespace Win32 -PassThru
# $api::u_strFromJavaModifiedUTF8WithSub(dest, destCapacity, pDestLength, src, srcLength, subchar, pNumSubstitutions, pErrorCode)#uselib "icuuc.dll"
#func global u_strFromJavaModifiedUTF8WithSub "u_strFromJavaModifiedUTF8WithSub" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; u_strFromJavaModifiedUTF8WithSub varptr(dest), destCapacity, varptr(pDestLength), src, srcLength, subchar, varptr(pNumSubstitutions), varptr(pErrorCode) ; 戻り値は stat
; dest : WORD* in/out -> "sptr"
; destCapacity : INT -> "sptr"
; pDestLength : INT* in/out -> "sptr"
; src : LPCSTR -> "sptr"
; srcLength : INT -> "sptr"
; subchar : INT -> "sptr"
; pNumSubstitutions : INT* in/out -> "sptr"
; pErrorCode : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuuc.dll" #cfunc global u_strFromJavaModifiedUTF8WithSub "u_strFromJavaModifiedUTF8WithSub" var, int, var, str, int, int, var, var ; res = u_strFromJavaModifiedUTF8WithSub(dest, destCapacity, pDestLength, src, srcLength, subchar, pNumSubstitutions, pErrorCode) ; dest : WORD* in/out -> "var" ; destCapacity : INT -> "int" ; pDestLength : INT* in/out -> "var" ; src : LPCSTR -> "str" ; srcLength : INT -> "int" ; subchar : INT -> "int" ; pNumSubstitutions : INT* in/out -> "var" ; pErrorCode : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuuc.dll" #cfunc global u_strFromJavaModifiedUTF8WithSub "u_strFromJavaModifiedUTF8WithSub" sptr, int, sptr, str, int, int, sptr, sptr ; res = u_strFromJavaModifiedUTF8WithSub(varptr(dest), destCapacity, varptr(pDestLength), src, srcLength, subchar, varptr(pNumSubstitutions), varptr(pErrorCode)) ; dest : WORD* in/out -> "sptr" ; destCapacity : INT -> "int" ; pDestLength : INT* in/out -> "sptr" ; src : LPCSTR -> "str" ; srcLength : INT -> "int" ; subchar : INT -> "int" ; pNumSubstitutions : INT* in/out -> "sptr" ; pErrorCode : UErrorCode* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; WORD* u_strFromJavaModifiedUTF8WithSub(WORD* dest, INT destCapacity, INT* pDestLength, LPCSTR src, INT srcLength, INT subchar, INT* pNumSubstitutions, UErrorCode* pErrorCode) #uselib "icuuc.dll" #cfunc global u_strFromJavaModifiedUTF8WithSub "u_strFromJavaModifiedUTF8WithSub" var, int, var, str, int, int, var, var ; res = u_strFromJavaModifiedUTF8WithSub(dest, destCapacity, pDestLength, src, srcLength, subchar, pNumSubstitutions, pErrorCode) ; dest : WORD* in/out -> "var" ; destCapacity : INT -> "int" ; pDestLength : INT* in/out -> "var" ; src : LPCSTR -> "str" ; srcLength : INT -> "int" ; subchar : INT -> "int" ; pNumSubstitutions : INT* in/out -> "var" ; pErrorCode : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; WORD* u_strFromJavaModifiedUTF8WithSub(WORD* dest, INT destCapacity, INT* pDestLength, LPCSTR src, INT srcLength, INT subchar, INT* pNumSubstitutions, UErrorCode* pErrorCode) #uselib "icuuc.dll" #cfunc global u_strFromJavaModifiedUTF8WithSub "u_strFromJavaModifiedUTF8WithSub" intptr, int, intptr, str, int, int, intptr, intptr ; res = u_strFromJavaModifiedUTF8WithSub(varptr(dest), destCapacity, varptr(pDestLength), src, srcLength, subchar, varptr(pNumSubstitutions), varptr(pErrorCode)) ; dest : WORD* in/out -> "intptr" ; destCapacity : INT -> "int" ; pDestLength : INT* in/out -> "intptr" ; src : LPCSTR -> "str" ; srcLength : INT -> "int" ; subchar : INT -> "int" ; pNumSubstitutions : INT* in/out -> "intptr" ; pErrorCode : UErrorCode* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuuc = windows.NewLazySystemDLL("icuuc.dll")
procu_strFromJavaModifiedUTF8WithSub = icuuc.NewProc("u_strFromJavaModifiedUTF8WithSub")
)
// dest (WORD* in/out), destCapacity (INT), pDestLength (INT* in/out), src (LPCSTR), srcLength (INT), subchar (INT), pNumSubstitutions (INT* in/out), pErrorCode (UErrorCode* in/out)
r1, _, err := procu_strFromJavaModifiedUTF8WithSub.Call(
uintptr(dest),
uintptr(destCapacity),
uintptr(pDestLength),
uintptr(unsafe.Pointer(windows.BytePtrFromString(src))),
uintptr(srcLength),
uintptr(subchar),
uintptr(pNumSubstitutions),
uintptr(pErrorCode),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // WORD*function u_strFromJavaModifiedUTF8WithSub(
dest: Pointer; // WORD* in/out
destCapacity: Integer; // INT
pDestLength: Pointer; // INT* in/out
src: PAnsiChar; // LPCSTR
srcLength: Integer; // INT
subchar: Integer; // INT
pNumSubstitutions: Pointer; // INT* in/out
pErrorCode: Pointer // UErrorCode* in/out
): Pointer; cdecl;
external 'icuuc.dll' name 'u_strFromJavaModifiedUTF8WithSub';result := DllCall("icuuc\u_strFromJavaModifiedUTF8WithSub"
, "Ptr", dest ; WORD* in/out
, "Int", destCapacity ; INT
, "Ptr", pDestLength ; INT* in/out
, "AStr", src ; LPCSTR
, "Int", srcLength ; INT
, "Int", subchar ; INT
, "Ptr", pNumSubstitutions ; INT* in/out
, "Ptr", pErrorCode ; UErrorCode* in/out
, "Cdecl Ptr") ; return: WORD*●u_strFromJavaModifiedUTF8WithSub(dest, destCapacity, pDestLength, src, srcLength, subchar, pNumSubstitutions, pErrorCode) = DLL("icuuc.dll", "void* u_strFromJavaModifiedUTF8WithSub(void*, int, void*, char*, int, int, void*, void*)")
# 呼び出し: u_strFromJavaModifiedUTF8WithSub(dest, destCapacity, pDestLength, src, srcLength, subchar, pNumSubstitutions, pErrorCode)
# dest : WORD* in/out -> "void*"
# destCapacity : INT -> "int"
# pDestLength : INT* in/out -> "void*"
# src : LPCSTR -> "char*"
# srcLength : INT -> "int"
# subchar : INT -> "int"
# pNumSubstitutions : INT* in/out -> "void*"
# 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 u_strFromJavaModifiedUTF8WithSub(
dest: [*c]u16, // WORD* in/out
destCapacity: i32, // INT
pDestLength: [*c]i32, // INT* in/out
src: [*c]const u8, // LPCSTR
srcLength: i32, // INT
subchar: i32, // INT
pNumSubstitutions: [*c]i32, // INT* in/out
pErrorCode: [*c]i32 // UErrorCode* in/out
) callconv(.c) [*c]u16;proc u_strFromJavaModifiedUTF8WithSub(
dest: ptr uint16, # WORD* in/out
destCapacity: int32, # INT
pDestLength: ptr int32, # INT* in/out
src: cstring, # LPCSTR
srcLength: int32, # INT
subchar: int32, # INT
pNumSubstitutions: ptr int32, # INT* in/out
pErrorCode: ptr int32 # UErrorCode* in/out
): ptr uint16 {.importc: "u_strFromJavaModifiedUTF8WithSub", cdecl, dynlib: "icuuc.dll".}pragma(lib, "icuuc");
extern(C)
ushort* u_strFromJavaModifiedUTF8WithSub(
ushort* dest, // WORD* in/out
int destCapacity, // INT
int* pDestLength, // INT* in/out
const(char)* src, // LPCSTR
int srcLength, // INT
int subchar, // INT
int* pNumSubstitutions, // INT* in/out
int* pErrorCode // UErrorCode* in/out
);ccall((:u_strFromJavaModifiedUTF8WithSub, "icuuc.dll"), Ptr{UInt16},
(Ptr{UInt16}, Int32, Ptr{Int32}, Cstring, Int32, Int32, Ptr{Int32}, Ptr{Int32}),
dest, destCapacity, pDestLength, src, srcLength, subchar, pNumSubstitutions, pErrorCode)
# dest : WORD* in/out -> Ptr{UInt16}
# destCapacity : INT -> Int32
# pDestLength : INT* in/out -> Ptr{Int32}
# src : LPCSTR -> Cstring
# srcLength : INT -> Int32
# subchar : INT -> Int32
# pNumSubstitutions : INT* in/out -> Ptr{Int32}
# pErrorCode : UErrorCode* in/out -> Ptr{Int32}local ffi = require("ffi")
ffi.cdef[[
uint16_t* u_strFromJavaModifiedUTF8WithSub(
uint16_t* dest,
int32_t destCapacity,
int32_t* pDestLength,
const char* src,
int32_t srcLength,
int32_t subchar,
int32_t* pNumSubstitutions,
int32_t* pErrorCode);
]]
local icuuc = ffi.load("icuuc")
-- icuuc.u_strFromJavaModifiedUTF8WithSub(dest, destCapacity, pDestLength, src, srcLength, subchar, pNumSubstitutions, pErrorCode)
-- dest : WORD* in/out
-- destCapacity : INT
-- pDestLength : INT* in/out
-- src : LPCSTR
-- srcLength : INT
-- subchar : INT
-- pNumSubstitutions : INT* in/out
-- pErrorCode : UErrorCode* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icuuc.dll');
const u_strFromJavaModifiedUTF8WithSub = lib.func('__cdecl', 'u_strFromJavaModifiedUTF8WithSub', 'uint16_t *', ['uint16_t *', 'int32_t', 'int32_t *', 'str', 'int32_t', 'int32_t', 'int32_t *', 'int32_t *']);
// u_strFromJavaModifiedUTF8WithSub(dest, destCapacity, pDestLength, src, srcLength, subchar, pNumSubstitutions, pErrorCode)
// dest : WORD* in/out -> 'uint16_t *'
// destCapacity : INT -> 'int32_t'
// pDestLength : INT* in/out -> 'int32_t *'
// src : LPCSTR -> 'str'
// srcLength : INT -> 'int32_t'
// subchar : INT -> 'int32_t'
// pNumSubstitutions : INT* in/out -> 'int32_t *'
// pErrorCode : UErrorCode* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("icuuc.dll", {
u_strFromJavaModifiedUTF8WithSub: { parameters: ["pointer", "i32", "pointer", "buffer", "i32", "i32", "pointer", "pointer"], result: "pointer" },
});
// lib.symbols.u_strFromJavaModifiedUTF8WithSub(dest, destCapacity, pDestLength, src, srcLength, subchar, pNumSubstitutions, pErrorCode)
// dest : WORD* in/out -> "pointer"
// destCapacity : INT -> "i32"
// pDestLength : INT* in/out -> "pointer"
// src : LPCSTR -> "buffer"
// srcLength : INT -> "i32"
// subchar : INT -> "i32"
// pNumSubstitutions : INT* in/out -> "pointer"
// pErrorCode : UErrorCode* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint16_t* u_strFromJavaModifiedUTF8WithSub(
uint16_t* dest,
int32_t destCapacity,
int32_t* pDestLength,
const char* src,
int32_t srcLength,
int32_t subchar,
int32_t* pNumSubstitutions,
int32_t* pErrorCode);
C, "icuuc.dll");
// $ffi->u_strFromJavaModifiedUTF8WithSub(dest, destCapacity, pDestLength, src, srcLength, subchar, pNumSubstitutions, pErrorCode);
// dest : WORD* in/out
// destCapacity : INT
// pDestLength : INT* in/out
// src : LPCSTR
// srcLength : INT
// subchar : INT
// pNumSubstitutions : INT* in/out
// 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);
Pointer u_strFromJavaModifiedUTF8WithSub(
ShortByReference dest, // WORD* in/out
int destCapacity, // INT
IntByReference pDestLength, // INT* in/out
String src, // LPCSTR
int srcLength, // INT
int subchar, // INT
IntByReference pNumSubstitutions, // INT* in/out
IntByReference pErrorCode // UErrorCode* in/out
);
}@[Link("icuuc")]
lib Libicuuc
fun u_strFromJavaModifiedUTF8WithSub = u_strFromJavaModifiedUTF8WithSub(
dest : UInt16*, # WORD* in/out
destCapacity : Int32, # INT
pDestLength : Int32*, # INT* in/out
src : UInt8*, # LPCSTR
srcLength : Int32, # INT
subchar : Int32, # INT
pNumSubstitutions : Int32*, # INT* in/out
pErrorCode : Int32* # UErrorCode* in/out
) : UInt16*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef u_strFromJavaModifiedUTF8WithSubNative = Pointer<Uint16> Function(Pointer<Uint16>, Int32, Pointer<Int32>, Pointer<Utf8>, Int32, Int32, Pointer<Int32>, Pointer<Int32>);
typedef u_strFromJavaModifiedUTF8WithSubDart = Pointer<Uint16> Function(Pointer<Uint16>, int, Pointer<Int32>, Pointer<Utf8>, int, int, Pointer<Int32>, Pointer<Int32>);
final u_strFromJavaModifiedUTF8WithSub = DynamicLibrary.open('icuuc.dll')
.lookupFunction<u_strFromJavaModifiedUTF8WithSubNative, u_strFromJavaModifiedUTF8WithSubDart>('u_strFromJavaModifiedUTF8WithSub');
// dest : WORD* in/out -> Pointer<Uint16>
// destCapacity : INT -> Int32
// pDestLength : INT* in/out -> Pointer<Int32>
// src : LPCSTR -> Pointer<Utf8>
// srcLength : INT -> Int32
// subchar : INT -> Int32
// pNumSubstitutions : INT* in/out -> Pointer<Int32>
// pErrorCode : UErrorCode* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function u_strFromJavaModifiedUTF8WithSub(
dest: Pointer; // WORD* in/out
destCapacity: Integer; // INT
pDestLength: Pointer; // INT* in/out
src: PAnsiChar; // LPCSTR
srcLength: Integer; // INT
subchar: Integer; // INT
pNumSubstitutions: Pointer; // INT* in/out
pErrorCode: Pointer // UErrorCode* in/out
): Pointer; cdecl;
external 'icuuc.dll' name 'u_strFromJavaModifiedUTF8WithSub';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "u_strFromJavaModifiedUTF8WithSub"
c_u_strFromJavaModifiedUTF8WithSub :: Ptr Word16 -> Int32 -> Ptr Int32 -> CString -> Int32 -> Int32 -> Ptr Int32 -> Ptr Int32 -> IO (Ptr Word16)
-- dest : WORD* in/out -> Ptr Word16
-- destCapacity : INT -> Int32
-- pDestLength : INT* in/out -> Ptr Int32
-- src : LPCSTR -> CString
-- srcLength : INT -> Int32
-- subchar : INT -> Int32
-- pNumSubstitutions : INT* in/out -> Ptr Int32
-- pErrorCode : UErrorCode* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let u_strfromjavamodifiedutf8withsub =
foreign "u_strFromJavaModifiedUTF8WithSub"
((ptr uint16_t) @-> int32_t @-> (ptr int32_t) @-> string @-> int32_t @-> int32_t @-> (ptr int32_t) @-> (ptr int32_t) @-> returning (ptr uint16_t))
(* dest : WORD* in/out -> (ptr uint16_t) *)
(* destCapacity : INT -> int32_t *)
(* pDestLength : INT* in/out -> (ptr int32_t) *)
(* src : LPCSTR -> string *)
(* srcLength : INT -> int32_t *)
(* subchar : INT -> int32_t *)
(* pNumSubstitutions : INT* in/out -> (ptr 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 ("u_strFromJavaModifiedUTF8WithSub" u-str-from-java-modified-utf8-with-sub :convention :cdecl) :pointer
(dest :pointer) ; WORD* in/out
(dest-capacity :int32) ; INT
(p-dest-length :pointer) ; INT* in/out
(src :string) ; LPCSTR
(src-length :int32) ; INT
(subchar :int32) ; INT
(p-num-substitutions :pointer) ; INT* in/out
(p-error-code :pointer)) ; UErrorCode* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $u_strFromJavaModifiedUTF8WithSub = Win32::API::More->new('icuuc',
'LPVOID u_strFromJavaModifiedUTF8WithSub(LPVOID dest, int destCapacity, LPVOID pDestLength, LPCSTR src, int srcLength, int subchar, LPVOID pNumSubstitutions, LPVOID pErrorCode)');
# my $ret = $u_strFromJavaModifiedUTF8WithSub->Call($dest, $destCapacity, $pDestLength, $src, $srcLength, $subchar, $pNumSubstitutions, $pErrorCode);
# dest : WORD* in/out -> LPVOID
# destCapacity : INT -> int
# pDestLength : INT* in/out -> LPVOID
# src : LPCSTR -> LPCSTR
# srcLength : INT -> int
# subchar : INT -> int
# pNumSubstitutions : INT* in/out -> LPVOID
# pErrorCode : UErrorCode* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型