ホーム › Devices.AllJoyn › alljoyn_interfacedescription_addmember
alljoyn_interfacedescription_addmember
関数インターフェイス記述にメソッドやシグナルのメンバーを追加する。
シグネチャ
// MSAJApi.dll
#include <windows.h>
QStatus alljoyn_interfacedescription_addmember(
alljoyn_interfacedescription iface,
alljoyn_messagetype type,
LPCSTR name,
LPCSTR inputSig,
LPCSTR outSig,
LPCSTR argNames,
BYTE annotation
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| iface | alljoyn_interfacedescription | in | メンバーを追加する対象のインターフェイス記述ハンドル。 |
| type | alljoyn_messagetype | in | 追加するメンバーのメッセージ種別(メソッド/シグナル等)。 |
| name | LPCSTR | in | 追加するメンバーの名前を表すNULL終端文字列。 |
| inputSig | LPCSTR | in | 入力引数のシグネチャを表すNULL終端文字列。 |
| outSig | LPCSTR | in | 出力引数のシグネチャを表すNULL終端文字列。 |
| argNames | LPCSTR | in | 引数名をカンマ区切りで列挙したNULL終端文字列。 |
| annotation | BYTE | in | メンバーに付与する注釈フラグを表すBYTE値(非推奨/グローバル等)。 |
戻り値の型: QStatus
各言語での呼び出し定義
// MSAJApi.dll
#include <windows.h>
QStatus alljoyn_interfacedescription_addmember(
alljoyn_interfacedescription iface,
alljoyn_messagetype type,
LPCSTR name,
LPCSTR inputSig,
LPCSTR outSig,
LPCSTR argNames,
BYTE annotation
);[DllImport("MSAJApi.dll", ExactSpelling = true)]
static extern int alljoyn_interfacedescription_addmember(
IntPtr iface, // alljoyn_interfacedescription
int type, // alljoyn_messagetype
[MarshalAs(UnmanagedType.LPStr)] string name, // LPCSTR
[MarshalAs(UnmanagedType.LPStr)] string inputSig, // LPCSTR
[MarshalAs(UnmanagedType.LPStr)] string outSig, // LPCSTR
[MarshalAs(UnmanagedType.LPStr)] string argNames, // LPCSTR
byte annotation // BYTE
);<DllImport("MSAJApi.dll", ExactSpelling:=True)>
Public Shared Function alljoyn_interfacedescription_addmember(
iface As IntPtr, ' alljoyn_interfacedescription
type As Integer, ' alljoyn_messagetype
<MarshalAs(UnmanagedType.LPStr)> name As String, ' LPCSTR
<MarshalAs(UnmanagedType.LPStr)> inputSig As String, ' LPCSTR
<MarshalAs(UnmanagedType.LPStr)> outSig As String, ' LPCSTR
<MarshalAs(UnmanagedType.LPStr)> argNames As String, ' LPCSTR
annotation As Byte ' BYTE
) As Integer
End Function' iface : alljoyn_interfacedescription
' type : alljoyn_messagetype
' name : LPCSTR
' inputSig : LPCSTR
' outSig : LPCSTR
' argNames : LPCSTR
' annotation : BYTE
Declare PtrSafe Function alljoyn_interfacedescription_addmember Lib "msajapi" ( _
ByVal iface As LongPtr, _
ByVal type As Long, _
ByVal name As String, _
ByVal inputSig As String, _
ByVal outSig As String, _
ByVal argNames As String, _
ByVal annotation As Byte) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
alljoyn_interfacedescription_addmember = ctypes.windll.msajapi.alljoyn_interfacedescription_addmember
alljoyn_interfacedescription_addmember.restype = ctypes.c_int
alljoyn_interfacedescription_addmember.argtypes = [
ctypes.c_ssize_t, # iface : alljoyn_interfacedescription
ctypes.c_int, # type : alljoyn_messagetype
wintypes.LPCSTR, # name : LPCSTR
wintypes.LPCSTR, # inputSig : LPCSTR
wintypes.LPCSTR, # outSig : LPCSTR
wintypes.LPCSTR, # argNames : LPCSTR
ctypes.c_ubyte, # annotation : BYTE
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MSAJApi.dll')
alljoyn_interfacedescription_addmember = Fiddle::Function.new(
lib['alljoyn_interfacedescription_addmember'],
[
Fiddle::TYPE_INTPTR_T, # iface : alljoyn_interfacedescription
Fiddle::TYPE_INT, # type : alljoyn_messagetype
Fiddle::TYPE_VOIDP, # name : LPCSTR
Fiddle::TYPE_VOIDP, # inputSig : LPCSTR
Fiddle::TYPE_VOIDP, # outSig : LPCSTR
Fiddle::TYPE_VOIDP, # argNames : LPCSTR
-Fiddle::TYPE_CHAR, # annotation : BYTE
],
Fiddle::TYPE_INT)#[link(name = "msajapi")]
extern "system" {
fn alljoyn_interfacedescription_addmember(
iface: isize, // alljoyn_interfacedescription
type: i32, // alljoyn_messagetype
name: *const u8, // LPCSTR
inputSig: *const u8, // LPCSTR
outSig: *const u8, // LPCSTR
argNames: *const u8, // LPCSTR
annotation: u8 // BYTE
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MSAJApi.dll")]
public static extern int alljoyn_interfacedescription_addmember(IntPtr iface, int type, [MarshalAs(UnmanagedType.LPStr)] string name, [MarshalAs(UnmanagedType.LPStr)] string inputSig, [MarshalAs(UnmanagedType.LPStr)] string outSig, [MarshalAs(UnmanagedType.LPStr)] string argNames, byte annotation);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSAJApi_alljoyn_interfacedescription_addmember' -Namespace Win32 -PassThru
# $api::alljoyn_interfacedescription_addmember(iface, type, name, inputSig, outSig, argNames, annotation)#uselib "MSAJApi.dll"
#func global alljoyn_interfacedescription_addmember "alljoyn_interfacedescription_addmember" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; alljoyn_interfacedescription_addmember iface, type, name, inputSig, outSig, argNames, annotation ; 戻り値は stat
; iface : alljoyn_interfacedescription -> "sptr"
; type : alljoyn_messagetype -> "sptr"
; name : LPCSTR -> "sptr"
; inputSig : LPCSTR -> "sptr"
; outSig : LPCSTR -> "sptr"
; argNames : LPCSTR -> "sptr"
; annotation : BYTE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "MSAJApi.dll"
#cfunc global alljoyn_interfacedescription_addmember "alljoyn_interfacedescription_addmember" sptr, int, str, str, str, str, int
; res = alljoyn_interfacedescription_addmember(iface, type, name, inputSig, outSig, argNames, annotation)
; iface : alljoyn_interfacedescription -> "sptr"
; type : alljoyn_messagetype -> "int"
; name : LPCSTR -> "str"
; inputSig : LPCSTR -> "str"
; outSig : LPCSTR -> "str"
; argNames : LPCSTR -> "str"
; annotation : BYTE -> "int"; QStatus alljoyn_interfacedescription_addmember(alljoyn_interfacedescription iface, alljoyn_messagetype type, LPCSTR name, LPCSTR inputSig, LPCSTR outSig, LPCSTR argNames, BYTE annotation)
#uselib "MSAJApi.dll"
#cfunc global alljoyn_interfacedescription_addmember "alljoyn_interfacedescription_addmember" intptr, int, str, str, str, str, int
; res = alljoyn_interfacedescription_addmember(iface, type, name, inputSig, outSig, argNames, annotation)
; iface : alljoyn_interfacedescription -> "intptr"
; type : alljoyn_messagetype -> "int"
; name : LPCSTR -> "str"
; inputSig : LPCSTR -> "str"
; outSig : LPCSTR -> "str"
; argNames : LPCSTR -> "str"
; annotation : BYTE -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msajapi = windows.NewLazySystemDLL("MSAJApi.dll")
procalljoyn_interfacedescription_addmember = msajapi.NewProc("alljoyn_interfacedescription_addmember")
)
// iface (alljoyn_interfacedescription), type (alljoyn_messagetype), name (LPCSTR), inputSig (LPCSTR), outSig (LPCSTR), argNames (LPCSTR), annotation (BYTE)
r1, _, err := procalljoyn_interfacedescription_addmember.Call(
uintptr(iface),
uintptr(type),
uintptr(unsafe.Pointer(windows.BytePtrFromString(name))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(inputSig))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(outSig))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(argNames))),
uintptr(annotation),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // QStatusfunction alljoyn_interfacedescription_addmember(
iface: NativeInt; // alljoyn_interfacedescription
type: Integer; // alljoyn_messagetype
name: PAnsiChar; // LPCSTR
inputSig: PAnsiChar; // LPCSTR
outSig: PAnsiChar; // LPCSTR
argNames: PAnsiChar; // LPCSTR
annotation: Byte // BYTE
): Integer; stdcall;
external 'MSAJApi.dll' name 'alljoyn_interfacedescription_addmember';result := DllCall("MSAJApi\alljoyn_interfacedescription_addmember"
, "Ptr", iface ; alljoyn_interfacedescription
, "Int", type ; alljoyn_messagetype
, "AStr", name ; LPCSTR
, "AStr", inputSig ; LPCSTR
, "AStr", outSig ; LPCSTR
, "AStr", argNames ; LPCSTR
, "UChar", annotation ; BYTE
, "Int") ; return: QStatus●alljoyn_interfacedescription_addmember(iface, type, name, inputSig, outSig, argNames, annotation) = DLL("MSAJApi.dll", "int alljoyn_interfacedescription_addmember(int, int, char*, char*, char*, char*, byte)")
# 呼び出し: alljoyn_interfacedescription_addmember(iface, type, name, inputSig, outSig, argNames, annotation)
# iface : alljoyn_interfacedescription -> "int"
# type : alljoyn_messagetype -> "int"
# name : LPCSTR -> "char*"
# inputSig : LPCSTR -> "char*"
# outSig : LPCSTR -> "char*"
# argNames : LPCSTR -> "char*"
# annotation : BYTE -> "byte"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "msajapi" fn alljoyn_interfacedescription_addmember(
iface: isize, // alljoyn_interfacedescription
type: i32, // alljoyn_messagetype
name: [*c]const u8, // LPCSTR
inputSig: [*c]const u8, // LPCSTR
outSig: [*c]const u8, // LPCSTR
argNames: [*c]const u8, // LPCSTR
annotation: u8 // BYTE
) callconv(std.os.windows.WINAPI) i32;proc alljoyn_interfacedescription_addmember(
iface: int, # alljoyn_interfacedescription
`type`: int32, # alljoyn_messagetype
name: cstring, # LPCSTR
inputSig: cstring, # LPCSTR
outSig: cstring, # LPCSTR
argNames: cstring, # LPCSTR
annotation: uint8 # BYTE
): int32 {.importc: "alljoyn_interfacedescription_addmember", stdcall, dynlib: "MSAJApi.dll".}pragma(lib, "msajapi");
extern(Windows)
int alljoyn_interfacedescription_addmember(
ptrdiff_t iface, // alljoyn_interfacedescription
int type, // alljoyn_messagetype
const(char)* name, // LPCSTR
const(char)* inputSig, // LPCSTR
const(char)* outSig, // LPCSTR
const(char)* argNames, // LPCSTR
ubyte annotation // BYTE
);ccall((:alljoyn_interfacedescription_addmember, "MSAJApi.dll"), stdcall, Int32,
(Int, Int32, Cstring, Cstring, Cstring, Cstring, UInt8),
iface, type, name, inputSig, outSig, argNames, annotation)
# iface : alljoyn_interfacedescription -> Int
# type : alljoyn_messagetype -> Int32
# name : LPCSTR -> Cstring
# inputSig : LPCSTR -> Cstring
# outSig : LPCSTR -> Cstring
# argNames : LPCSTR -> Cstring
# annotation : BYTE -> UInt8
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t alljoyn_interfacedescription_addmember(
intptr_t iface,
int32_t type,
const char* name,
const char* inputSig,
const char* outSig,
const char* argNames,
uint8_t annotation);
]]
local msajapi = ffi.load("msajapi")
-- msajapi.alljoyn_interfacedescription_addmember(iface, type, name, inputSig, outSig, argNames, annotation)
-- iface : alljoyn_interfacedescription
-- type : alljoyn_messagetype
-- name : LPCSTR
-- inputSig : LPCSTR
-- outSig : LPCSTR
-- argNames : LPCSTR
-- annotation : BYTE
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('MSAJApi.dll');
const alljoyn_interfacedescription_addmember = lib.func('__stdcall', 'alljoyn_interfacedescription_addmember', 'int32_t', ['intptr_t', 'int32_t', 'str', 'str', 'str', 'str', 'uint8_t']);
// alljoyn_interfacedescription_addmember(iface, type, name, inputSig, outSig, argNames, annotation)
// iface : alljoyn_interfacedescription -> 'intptr_t'
// type : alljoyn_messagetype -> 'int32_t'
// name : LPCSTR -> 'str'
// inputSig : LPCSTR -> 'str'
// outSig : LPCSTR -> 'str'
// argNames : LPCSTR -> 'str'
// annotation : BYTE -> 'uint8_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("MSAJApi.dll", {
alljoyn_interfacedescription_addmember: { parameters: ["isize", "i32", "buffer", "buffer", "buffer", "buffer", "u8"], result: "i32" },
});
// lib.symbols.alljoyn_interfacedescription_addmember(iface, type, name, inputSig, outSig, argNames, annotation)
// iface : alljoyn_interfacedescription -> "isize"
// type : alljoyn_messagetype -> "i32"
// name : LPCSTR -> "buffer"
// inputSig : LPCSTR -> "buffer"
// outSig : LPCSTR -> "buffer"
// argNames : LPCSTR -> "buffer"
// annotation : BYTE -> "u8"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t alljoyn_interfacedescription_addmember(
intptr_t iface,
int32_t type,
const char* name,
const char* inputSig,
const char* outSig,
const char* argNames,
uint8_t annotation);
C, "MSAJApi.dll");
// $ffi->alljoyn_interfacedescription_addmember(iface, type, name, inputSig, outSig, argNames, annotation);
// iface : alljoyn_interfacedescription
// type : alljoyn_messagetype
// name : LPCSTR
// inputSig : LPCSTR
// outSig : LPCSTR
// argNames : LPCSTR
// annotation : BYTE
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Msajapi extends StdCallLibrary {
Msajapi INSTANCE = Native.load("msajapi", Msajapi.class);
int alljoyn_interfacedescription_addmember(
long iface, // alljoyn_interfacedescription
int type, // alljoyn_messagetype
String name, // LPCSTR
String inputSig, // LPCSTR
String outSig, // LPCSTR
String argNames, // LPCSTR
byte annotation // BYTE
);
}@[Link("msajapi")]
lib LibMSAJApi
fun alljoyn_interfacedescription_addmember = alljoyn_interfacedescription_addmember(
iface : LibC::SSizeT, # alljoyn_interfacedescription
type_ : Int32, # alljoyn_messagetype
name : UInt8*, # LPCSTR
inputSig : UInt8*, # LPCSTR
outSig : UInt8*, # LPCSTR
argNames : UInt8*, # LPCSTR
annotation : UInt8 # BYTE
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef alljoyn_interfacedescription_addmemberNative = Int32 Function(IntPtr, Int32, Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>, Uint8);
typedef alljoyn_interfacedescription_addmemberDart = int Function(int, int, Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>, int);
final alljoyn_interfacedescription_addmember = DynamicLibrary.open('MSAJApi.dll')
.lookupFunction<alljoyn_interfacedescription_addmemberNative, alljoyn_interfacedescription_addmemberDart>('alljoyn_interfacedescription_addmember');
// iface : alljoyn_interfacedescription -> IntPtr
// type : alljoyn_messagetype -> Int32
// name : LPCSTR -> Pointer<Utf8>
// inputSig : LPCSTR -> Pointer<Utf8>
// outSig : LPCSTR -> Pointer<Utf8>
// argNames : LPCSTR -> Pointer<Utf8>
// annotation : BYTE -> Uint8
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function alljoyn_interfacedescription_addmember(
iface: NativeInt; // alljoyn_interfacedescription
type: Integer; // alljoyn_messagetype
name: PAnsiChar; // LPCSTR
inputSig: PAnsiChar; // LPCSTR
outSig: PAnsiChar; // LPCSTR
argNames: PAnsiChar; // LPCSTR
annotation: Byte // BYTE
): Integer; stdcall;
external 'MSAJApi.dll' name 'alljoyn_interfacedescription_addmember';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "alljoyn_interfacedescription_addmember"
c_alljoyn_interfacedescription_addmember :: CIntPtr -> Int32 -> CString -> CString -> CString -> CString -> Word8 -> IO Int32
-- iface : alljoyn_interfacedescription -> CIntPtr
-- type : alljoyn_messagetype -> Int32
-- name : LPCSTR -> CString
-- inputSig : LPCSTR -> CString
-- outSig : LPCSTR -> CString
-- argNames : LPCSTR -> CString
-- annotation : BYTE -> Word8
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let alljoyn_interfacedescription_addmember =
foreign "alljoyn_interfacedescription_addmember"
(intptr_t @-> int32_t @-> string @-> string @-> string @-> string @-> uint8_t @-> returning int32_t)
(* iface : alljoyn_interfacedescription -> intptr_t *)
(* type : alljoyn_messagetype -> int32_t *)
(* name : LPCSTR -> string *)
(* inputSig : LPCSTR -> string *)
(* outSig : LPCSTR -> string *)
(* argNames : LPCSTR -> string *)
(* annotation : BYTE -> uint8_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library msajapi (t "MSAJApi.dll"))
(cffi:use-foreign-library msajapi)
(cffi:defcfun ("alljoyn_interfacedescription_addmember" alljoyn-interfacedescription-addmember :convention :stdcall) :int32
(iface :int64) ; alljoyn_interfacedescription
(type :int32) ; alljoyn_messagetype
(name :string) ; LPCSTR
(input-sig :string) ; LPCSTR
(out-sig :string) ; LPCSTR
(arg-names :string) ; LPCSTR
(annotation :uint8)) ; BYTE
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $alljoyn_interfacedescription_addmember = Win32::API::More->new('MSAJApi',
'int alljoyn_interfacedescription_addmember(LPARAM iface, int type, LPCSTR name, LPCSTR inputSig, LPCSTR outSig, LPCSTR argNames, BYTE annotation)');
# my $ret = $alljoyn_interfacedescription_addmember->Call($iface, $type, $name, $inputSig, $outSig, $argNames, $annotation);
# iface : alljoyn_interfacedescription -> LPARAM
# type : alljoyn_messagetype -> int
# name : LPCSTR -> LPCSTR
# inputSig : LPCSTR -> LPCSTR
# outSig : LPCSTR -> LPCSTR
# argNames : LPCSTR -> LPCSTR
# annotation : BYTE -> BYTE
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。