Win32 API 日本語リファレンス
ホームDevices.AllJoyn › alljoyn_observer_create

alljoyn_observer_create

関数
指定インターフェースを持つオブジェクトを検出するオブザーバーを生成する。
DLLMSAJApi.dll呼出規約winapi

シグネチャ

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

alljoyn_observer alljoyn_observer_create(
    alljoyn_busattachment bus,
    const CHAR** mandatoryInterfaces,
    UINT_PTR numMandatoryInterfaces
);

パラメーター

名前方向説明
busalljoyn_busattachmentinオブザーバを生成する対象のバスアタッチメントハンドル。
mandatoryInterfacesCHAR**in検出条件として全て実装が必須となるインターフェイス名の配列。
numMandatoryInterfacesUINT_PTRinmandatoryInterfaces配列の要素数。

戻り値の型: alljoyn_observer

各言語での呼び出し定義

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

alljoyn_observer alljoyn_observer_create(
    alljoyn_busattachment bus,
    const CHAR** mandatoryInterfaces,
    UINT_PTR numMandatoryInterfaces
);
[DllImport("MSAJApi.dll", ExactSpelling = true)]
static extern IntPtr alljoyn_observer_create(
    IntPtr bus,   // alljoyn_busattachment
    IntPtr mandatoryInterfaces,   // CHAR**
    UIntPtr numMandatoryInterfaces   // UINT_PTR
);
<DllImport("MSAJApi.dll", ExactSpelling:=True)>
Public Shared Function alljoyn_observer_create(
    bus As IntPtr,   ' alljoyn_busattachment
    mandatoryInterfaces As IntPtr,   ' CHAR**
    numMandatoryInterfaces As UIntPtr   ' UINT_PTR
) As IntPtr
End Function
' bus : alljoyn_busattachment
' mandatoryInterfaces : CHAR**
' numMandatoryInterfaces : UINT_PTR
Declare PtrSafe Function alljoyn_observer_create Lib "msajapi" ( _
    ByVal bus As LongPtr, _
    ByVal mandatoryInterfaces As LongPtr, _
    ByVal numMandatoryInterfaces As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

alljoyn_observer_create = ctypes.windll.msajapi.alljoyn_observer_create
alljoyn_observer_create.restype = ctypes.c_ssize_t
alljoyn_observer_create.argtypes = [
    ctypes.c_ssize_t,  # bus : alljoyn_busattachment
    ctypes.c_void_p,  # mandatoryInterfaces : CHAR**
    ctypes.c_size_t,  # numMandatoryInterfaces : UINT_PTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MSAJApi.dll')
alljoyn_observer_create = Fiddle::Function.new(
  lib['alljoyn_observer_create'],
  [
    Fiddle::TYPE_INTPTR_T,  # bus : alljoyn_busattachment
    Fiddle::TYPE_VOIDP,  # mandatoryInterfaces : CHAR**
    Fiddle::TYPE_UINTPTR_T,  # numMandatoryInterfaces : UINT_PTR
  ],
  Fiddle::TYPE_INTPTR_T)
#[link(name = "msajapi")]
extern "system" {
    fn alljoyn_observer_create(
        bus: isize,  // alljoyn_busattachment
        mandatoryInterfaces: *const *const i8,  // CHAR**
        numMandatoryInterfaces: usize  // UINT_PTR
    ) -> isize;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MSAJApi.dll")]
public static extern IntPtr alljoyn_observer_create(IntPtr bus, IntPtr mandatoryInterfaces, UIntPtr numMandatoryInterfaces);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSAJApi_alljoyn_observer_create' -Namespace Win32 -PassThru
# $api::alljoyn_observer_create(bus, mandatoryInterfaces, numMandatoryInterfaces)
#uselib "MSAJApi.dll"
#func global alljoyn_observer_create "alljoyn_observer_create" sptr, sptr, sptr
; alljoyn_observer_create bus, varptr(mandatoryInterfaces), numMandatoryInterfaces   ; 戻り値は stat
; bus : alljoyn_busattachment -> "sptr"
; mandatoryInterfaces : CHAR** -> "sptr"
; numMandatoryInterfaces : UINT_PTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "MSAJApi.dll"
#cfunc global alljoyn_observer_create "alljoyn_observer_create" sptr, var, sptr
; res = alljoyn_observer_create(bus, mandatoryInterfaces, numMandatoryInterfaces)
; bus : alljoyn_busattachment -> "sptr"
; mandatoryInterfaces : CHAR** -> "var"
; numMandatoryInterfaces : UINT_PTR -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; alljoyn_observer alljoyn_observer_create(alljoyn_busattachment bus, CHAR** mandatoryInterfaces, UINT_PTR numMandatoryInterfaces)
#uselib "MSAJApi.dll"
#cfunc global alljoyn_observer_create "alljoyn_observer_create" intptr, var, intptr
; res = alljoyn_observer_create(bus, mandatoryInterfaces, numMandatoryInterfaces)
; bus : alljoyn_busattachment -> "intptr"
; mandatoryInterfaces : CHAR** -> "var"
; numMandatoryInterfaces : UINT_PTR -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msajapi = windows.NewLazySystemDLL("MSAJApi.dll")
	procalljoyn_observer_create = msajapi.NewProc("alljoyn_observer_create")
)

// bus (alljoyn_busattachment), mandatoryInterfaces (CHAR**), numMandatoryInterfaces (UINT_PTR)
r1, _, err := procalljoyn_observer_create.Call(
	uintptr(bus),
	uintptr(mandatoryInterfaces),
	uintptr(numMandatoryInterfaces),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // alljoyn_observer
function alljoyn_observer_create(
  bus: NativeInt;   // alljoyn_busattachment
  mandatoryInterfaces: Pointer;   // CHAR**
  numMandatoryInterfaces: NativeUInt   // UINT_PTR
): NativeInt; stdcall;
  external 'MSAJApi.dll' name 'alljoyn_observer_create';
result := DllCall("MSAJApi\alljoyn_observer_create"
    , "Ptr", bus   ; alljoyn_busattachment
    , "Ptr", mandatoryInterfaces   ; CHAR**
    , "UPtr", numMandatoryInterfaces   ; UINT_PTR
    , "Ptr")   ; return: alljoyn_observer
●alljoyn_observer_create(bus, mandatoryInterfaces, numMandatoryInterfaces) = DLL("MSAJApi.dll", "int alljoyn_observer_create(int, void*, int)")
# 呼び出し: alljoyn_observer_create(bus, mandatoryInterfaces, numMandatoryInterfaces)
# bus : alljoyn_busattachment -> "int"
# mandatoryInterfaces : CHAR** -> "void*"
# numMandatoryInterfaces : UINT_PTR -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。