ホーム › Devices.AllJoyn › alljoyn_interfacedescription_addmethod
alljoyn_interfacedescription_addmethod
関数インターフェイス記述にメソッドメンバーを追加する。
シグネチャ
// MSAJApi.dll
#include <windows.h>
QStatus alljoyn_interfacedescription_addmethod(
alljoyn_interfacedescription iface,
LPCSTR name,
LPCSTR inputSig,
LPCSTR outSig,
LPCSTR argNames,
BYTE annotation,
LPCSTR accessPerms
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| iface | alljoyn_interfacedescription | in | メソッドを追加する対象のインターフェイス記述ハンドル。 |
| name | LPCSTR | in | 追加するメソッドの名前を表すNULL終端文字列。 |
| inputSig | LPCSTR | in | 入力引数のシグネチャを表すNULL終端文字列。 |
| outSig | LPCSTR | in | 出力引数のシグネチャを表すNULL終端文字列。 |
| argNames | LPCSTR | in | 引数名をカンマ区切りで列挙したNULL終端文字列。 |
| annotation | BYTE | in | メソッドに付与する注釈フラグを表すBYTE値。 |
| accessPerms | LPCSTR | in | メソッドに必要なアクセス権限を表すNULL終端文字列。 |
戻り値の型: QStatus
各言語での呼び出し定義
// MSAJApi.dll
#include <windows.h>
QStatus alljoyn_interfacedescription_addmethod(
alljoyn_interfacedescription iface,
LPCSTR name,
LPCSTR inputSig,
LPCSTR outSig,
LPCSTR argNames,
BYTE annotation,
LPCSTR accessPerms
);[DllImport("MSAJApi.dll", ExactSpelling = true)]
static extern int alljoyn_interfacedescription_addmethod(
IntPtr iface, // alljoyn_interfacedescription
[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
[MarshalAs(UnmanagedType.LPStr)] string accessPerms // LPCSTR
);<DllImport("MSAJApi.dll", ExactSpelling:=True)>
Public Shared Function alljoyn_interfacedescription_addmethod(
iface As IntPtr, ' alljoyn_interfacedescription
<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
<MarshalAs(UnmanagedType.LPStr)> accessPerms As String ' LPCSTR
) As Integer
End Function' iface : alljoyn_interfacedescription
' name : LPCSTR
' inputSig : LPCSTR
' outSig : LPCSTR
' argNames : LPCSTR
' annotation : BYTE
' accessPerms : LPCSTR
Declare PtrSafe Function alljoyn_interfacedescription_addmethod Lib "msajapi" ( _
ByVal iface As LongPtr, _
ByVal name As String, _
ByVal inputSig As String, _
ByVal outSig As String, _
ByVal argNames As String, _
ByVal annotation As Byte, _
ByVal accessPerms As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
alljoyn_interfacedescription_addmethod = ctypes.windll.msajapi.alljoyn_interfacedescription_addmethod
alljoyn_interfacedescription_addmethod.restype = ctypes.c_int
alljoyn_interfacedescription_addmethod.argtypes = [
ctypes.c_ssize_t, # iface : alljoyn_interfacedescription
wintypes.LPCSTR, # name : LPCSTR
wintypes.LPCSTR, # inputSig : LPCSTR
wintypes.LPCSTR, # outSig : LPCSTR
wintypes.LPCSTR, # argNames : LPCSTR
ctypes.c_ubyte, # annotation : BYTE
wintypes.LPCSTR, # accessPerms : LPCSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MSAJApi.dll')
alljoyn_interfacedescription_addmethod = Fiddle::Function.new(
lib['alljoyn_interfacedescription_addmethod'],
[
Fiddle::TYPE_INTPTR_T, # iface : alljoyn_interfacedescription
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_VOIDP, # accessPerms : LPCSTR
],
Fiddle::TYPE_INT)#[link(name = "msajapi")]
extern "system" {
fn alljoyn_interfacedescription_addmethod(
iface: isize, // alljoyn_interfacedescription
name: *const u8, // LPCSTR
inputSig: *const u8, // LPCSTR
outSig: *const u8, // LPCSTR
argNames: *const u8, // LPCSTR
annotation: u8, // BYTE
accessPerms: *const u8 // LPCSTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MSAJApi.dll")]
public static extern int alljoyn_interfacedescription_addmethod(IntPtr iface, [MarshalAs(UnmanagedType.LPStr)] string name, [MarshalAs(UnmanagedType.LPStr)] string inputSig, [MarshalAs(UnmanagedType.LPStr)] string outSig, [MarshalAs(UnmanagedType.LPStr)] string argNames, byte annotation, [MarshalAs(UnmanagedType.LPStr)] string accessPerms);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSAJApi_alljoyn_interfacedescription_addmethod' -Namespace Win32 -PassThru
# $api::alljoyn_interfacedescription_addmethod(iface, name, inputSig, outSig, argNames, annotation, accessPerms)#uselib "MSAJApi.dll"
#func global alljoyn_interfacedescription_addmethod "alljoyn_interfacedescription_addmethod" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; alljoyn_interfacedescription_addmethod iface, name, inputSig, outSig, argNames, annotation, accessPerms ; 戻り値は stat
; iface : alljoyn_interfacedescription -> "sptr"
; name : LPCSTR -> "sptr"
; inputSig : LPCSTR -> "sptr"
; outSig : LPCSTR -> "sptr"
; argNames : LPCSTR -> "sptr"
; annotation : BYTE -> "sptr"
; accessPerms : LPCSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "MSAJApi.dll"
#cfunc global alljoyn_interfacedescription_addmethod "alljoyn_interfacedescription_addmethod" sptr, str, str, str, str, int, str
; res = alljoyn_interfacedescription_addmethod(iface, name, inputSig, outSig, argNames, annotation, accessPerms)
; iface : alljoyn_interfacedescription -> "sptr"
; name : LPCSTR -> "str"
; inputSig : LPCSTR -> "str"
; outSig : LPCSTR -> "str"
; argNames : LPCSTR -> "str"
; annotation : BYTE -> "int"
; accessPerms : LPCSTR -> "str"; QStatus alljoyn_interfacedescription_addmethod(alljoyn_interfacedescription iface, LPCSTR name, LPCSTR inputSig, LPCSTR outSig, LPCSTR argNames, BYTE annotation, LPCSTR accessPerms)
#uselib "MSAJApi.dll"
#cfunc global alljoyn_interfacedescription_addmethod "alljoyn_interfacedescription_addmethod" intptr, str, str, str, str, int, str
; res = alljoyn_interfacedescription_addmethod(iface, name, inputSig, outSig, argNames, annotation, accessPerms)
; iface : alljoyn_interfacedescription -> "intptr"
; name : LPCSTR -> "str"
; inputSig : LPCSTR -> "str"
; outSig : LPCSTR -> "str"
; argNames : LPCSTR -> "str"
; annotation : BYTE -> "int"
; accessPerms : LPCSTR -> "str"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msajapi = windows.NewLazySystemDLL("MSAJApi.dll")
procalljoyn_interfacedescription_addmethod = msajapi.NewProc("alljoyn_interfacedescription_addmethod")
)
// iface (alljoyn_interfacedescription), name (LPCSTR), inputSig (LPCSTR), outSig (LPCSTR), argNames (LPCSTR), annotation (BYTE), accessPerms (LPCSTR)
r1, _, err := procalljoyn_interfacedescription_addmethod.Call(
uintptr(iface),
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),
uintptr(unsafe.Pointer(windows.BytePtrFromString(accessPerms))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // QStatusfunction alljoyn_interfacedescription_addmethod(
iface: NativeInt; // alljoyn_interfacedescription
name: PAnsiChar; // LPCSTR
inputSig: PAnsiChar; // LPCSTR
outSig: PAnsiChar; // LPCSTR
argNames: PAnsiChar; // LPCSTR
annotation: Byte; // BYTE
accessPerms: PAnsiChar // LPCSTR
): Integer; stdcall;
external 'MSAJApi.dll' name 'alljoyn_interfacedescription_addmethod';result := DllCall("MSAJApi\alljoyn_interfacedescription_addmethod"
, "Ptr", iface ; alljoyn_interfacedescription
, "AStr", name ; LPCSTR
, "AStr", inputSig ; LPCSTR
, "AStr", outSig ; LPCSTR
, "AStr", argNames ; LPCSTR
, "UChar", annotation ; BYTE
, "AStr", accessPerms ; LPCSTR
, "Int") ; return: QStatus●alljoyn_interfacedescription_addmethod(iface, name, inputSig, outSig, argNames, annotation, accessPerms) = DLL("MSAJApi.dll", "int alljoyn_interfacedescription_addmethod(int, char*, char*, char*, char*, byte, char*)")
# 呼び出し: alljoyn_interfacedescription_addmethod(iface, name, inputSig, outSig, argNames, annotation, accessPerms)
# iface : alljoyn_interfacedescription -> "int"
# name : LPCSTR -> "char*"
# inputSig : LPCSTR -> "char*"
# outSig : LPCSTR -> "char*"
# argNames : LPCSTR -> "char*"
# annotation : BYTE -> "byte"
# accessPerms : LPCSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。