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

alljoyn_interfacedescription_addsignal

関数
インターフェイス記述にシグナルメンバーを追加する。
DLLMSAJApi.dll呼出規約winapi

シグネチャ

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

QStatus alljoyn_interfacedescription_addsignal(
    alljoyn_interfacedescription iface,
    LPCSTR name,
    LPCSTR sig,
    LPCSTR argNames,
    BYTE annotation,
    LPCSTR accessPerms
);

パラメーター

名前方向説明
ifacealljoyn_interfacedescriptioninシグナルを追加する対象のインターフェース記述ハンドル。
nameLPCSTRin追加するシグナルの名前を指すNULL終端文字列。
sigLPCSTRinシグナル引数の型を表すDBus署名文字列。各引数の型を連結したもの。
argNamesLPCSTRin各引数名をカンマ区切りで列挙したNULL終端文字列。
annotationBYTEinシグナルに付与する注釈フラグのビット値。非推奨等を示す。
accessPermsLPCSTRinアクセス権限を示すNULL終端文字列。NULL可。

戻り値の型: QStatus

各言語での呼び出し定義

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

QStatus alljoyn_interfacedescription_addsignal(
    alljoyn_interfacedescription iface,
    LPCSTR name,
    LPCSTR sig,
    LPCSTR argNames,
    BYTE annotation,
    LPCSTR accessPerms
);
[DllImport("MSAJApi.dll", ExactSpelling = true)]
static extern int alljoyn_interfacedescription_addsignal(
    IntPtr iface,   // alljoyn_interfacedescription
    [MarshalAs(UnmanagedType.LPStr)] string name,   // LPCSTR
    [MarshalAs(UnmanagedType.LPStr)] string sig,   // 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_addsignal(
    iface As IntPtr,   ' alljoyn_interfacedescription
    <MarshalAs(UnmanagedType.LPStr)> name As String,   ' LPCSTR
    <MarshalAs(UnmanagedType.LPStr)> sig 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
' sig : LPCSTR
' argNames : LPCSTR
' annotation : BYTE
' accessPerms : LPCSTR
Declare PtrSafe Function alljoyn_interfacedescription_addsignal Lib "msajapi" ( _
    ByVal iface As LongPtr, _
    ByVal name As String, _
    ByVal sig 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_addsignal = ctypes.windll.msajapi.alljoyn_interfacedescription_addsignal
alljoyn_interfacedescription_addsignal.restype = ctypes.c_int
alljoyn_interfacedescription_addsignal.argtypes = [
    ctypes.c_ssize_t,  # iface : alljoyn_interfacedescription
    wintypes.LPCSTR,  # name : LPCSTR
    wintypes.LPCSTR,  # sig : 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_addsignal = Fiddle::Function.new(
  lib['alljoyn_interfacedescription_addsignal'],
  [
    Fiddle::TYPE_INTPTR_T,  # iface : alljoyn_interfacedescription
    Fiddle::TYPE_VOIDP,  # name : LPCSTR
    Fiddle::TYPE_VOIDP,  # sig : 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_addsignal(
        iface: isize,  // alljoyn_interfacedescription
        name: *const u8,  // LPCSTR
        sig: *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_addsignal(IntPtr iface, [MarshalAs(UnmanagedType.LPStr)] string name, [MarshalAs(UnmanagedType.LPStr)] string sig, [MarshalAs(UnmanagedType.LPStr)] string argNames, byte annotation, [MarshalAs(UnmanagedType.LPStr)] string accessPerms);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSAJApi_alljoyn_interfacedescription_addsignal' -Namespace Win32 -PassThru
# $api::alljoyn_interfacedescription_addsignal(iface, name, sig, argNames, annotation, accessPerms)
#uselib "MSAJApi.dll"
#func global alljoyn_interfacedescription_addsignal "alljoyn_interfacedescription_addsignal" sptr, sptr, sptr, sptr, sptr, sptr
; alljoyn_interfacedescription_addsignal iface, name, sig, argNames, annotation, accessPerms   ; 戻り値は stat
; iface : alljoyn_interfacedescription -> "sptr"
; name : LPCSTR -> "sptr"
; sig : LPCSTR -> "sptr"
; argNames : LPCSTR -> "sptr"
; annotation : BYTE -> "sptr"
; accessPerms : LPCSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "MSAJApi.dll"
#cfunc global alljoyn_interfacedescription_addsignal "alljoyn_interfacedescription_addsignal" sptr, str, str, str, int, str
; res = alljoyn_interfacedescription_addsignal(iface, name, sig, argNames, annotation, accessPerms)
; iface : alljoyn_interfacedescription -> "sptr"
; name : LPCSTR -> "str"
; sig : LPCSTR -> "str"
; argNames : LPCSTR -> "str"
; annotation : BYTE -> "int"
; accessPerms : LPCSTR -> "str"
; QStatus alljoyn_interfacedescription_addsignal(alljoyn_interfacedescription iface, LPCSTR name, LPCSTR sig, LPCSTR argNames, BYTE annotation, LPCSTR accessPerms)
#uselib "MSAJApi.dll"
#cfunc global alljoyn_interfacedescription_addsignal "alljoyn_interfacedescription_addsignal" intptr, str, str, str, int, str
; res = alljoyn_interfacedescription_addsignal(iface, name, sig, argNames, annotation, accessPerms)
; iface : alljoyn_interfacedescription -> "intptr"
; name : LPCSTR -> "str"
; sig : 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_addsignal = msajapi.NewProc("alljoyn_interfacedescription_addsignal")
)

// iface (alljoyn_interfacedescription), name (LPCSTR), sig (LPCSTR), argNames (LPCSTR), annotation (BYTE), accessPerms (LPCSTR)
r1, _, err := procalljoyn_interfacedescription_addsignal.Call(
	uintptr(iface),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(name))),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(sig))),
	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   // QStatus
function alljoyn_interfacedescription_addsignal(
  iface: NativeInt;   // alljoyn_interfacedescription
  name: PAnsiChar;   // LPCSTR
  sig: PAnsiChar;   // LPCSTR
  argNames: PAnsiChar;   // LPCSTR
  annotation: Byte;   // BYTE
  accessPerms: PAnsiChar   // LPCSTR
): Integer; stdcall;
  external 'MSAJApi.dll' name 'alljoyn_interfacedescription_addsignal';
result := DllCall("MSAJApi\alljoyn_interfacedescription_addsignal"
    , "Ptr", iface   ; alljoyn_interfacedescription
    , "AStr", name   ; LPCSTR
    , "AStr", sig   ; LPCSTR
    , "AStr", argNames   ; LPCSTR
    , "UChar", annotation   ; BYTE
    , "AStr", accessPerms   ; LPCSTR
    , "Int")   ; return: QStatus
●alljoyn_interfacedescription_addsignal(iface, name, sig, argNames, annotation, accessPerms) = DLL("MSAJApi.dll", "int alljoyn_interfacedescription_addsignal(int, char*, char*, char*, byte, char*)")
# 呼び出し: alljoyn_interfacedescription_addsignal(iface, name, sig, argNames, annotation, accessPerms)
# iface : alljoyn_interfacedescription -> "int"
# name : LPCSTR -> "char*"
# sig : LPCSTR -> "char*"
# argNames : LPCSTR -> "char*"
# annotation : BYTE -> "byte"
# accessPerms : LPCSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "msajapi" fn alljoyn_interfacedescription_addsignal(
    iface: isize, // alljoyn_interfacedescription
    name: [*c]const u8, // LPCSTR
    sig: [*c]const u8, // LPCSTR
    argNames: [*c]const u8, // LPCSTR
    annotation: u8, // BYTE
    accessPerms: [*c]const u8 // LPCSTR
) callconv(std.os.windows.WINAPI) i32;
proc alljoyn_interfacedescription_addsignal(
    iface: int,  # alljoyn_interfacedescription
    name: cstring,  # LPCSTR
    sig: cstring,  # LPCSTR
    argNames: cstring,  # LPCSTR
    annotation: uint8,  # BYTE
    accessPerms: cstring  # LPCSTR
): int32 {.importc: "alljoyn_interfacedescription_addsignal", stdcall, dynlib: "MSAJApi.dll".}
pragma(lib, "msajapi");
extern(Windows)
int alljoyn_interfacedescription_addsignal(
    ptrdiff_t iface,   // alljoyn_interfacedescription
    const(char)* name,   // LPCSTR
    const(char)* sig,   // LPCSTR
    const(char)* argNames,   // LPCSTR
    ubyte annotation,   // BYTE
    const(char)* accessPerms   // LPCSTR
);
ccall((:alljoyn_interfacedescription_addsignal, "MSAJApi.dll"), stdcall, Int32,
      (Int, Cstring, Cstring, Cstring, UInt8, Cstring),
      iface, name, sig, argNames, annotation, accessPerms)
# iface : alljoyn_interfacedescription -> Int
# name : LPCSTR -> Cstring
# sig : LPCSTR -> Cstring
# argNames : LPCSTR -> Cstring
# annotation : BYTE -> UInt8
# accessPerms : LPCSTR -> Cstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t alljoyn_interfacedescription_addsignal(
    intptr_t iface,
    const char* name,
    const char* sig,
    const char* argNames,
    uint8_t annotation,
    const char* accessPerms);
]]
local msajapi = ffi.load("msajapi")
-- msajapi.alljoyn_interfacedescription_addsignal(iface, name, sig, argNames, annotation, accessPerms)
-- iface : alljoyn_interfacedescription
-- name : LPCSTR
-- sig : LPCSTR
-- argNames : LPCSTR
-- annotation : BYTE
-- accessPerms : LPCSTR
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('MSAJApi.dll');
const alljoyn_interfacedescription_addsignal = lib.func('__stdcall', 'alljoyn_interfacedescription_addsignal', 'int32_t', ['intptr_t', 'str', 'str', 'str', 'uint8_t', 'str']);
// alljoyn_interfacedescription_addsignal(iface, name, sig, argNames, annotation, accessPerms)
// iface : alljoyn_interfacedescription -> 'intptr_t'
// name : LPCSTR -> 'str'
// sig : LPCSTR -> 'str'
// argNames : LPCSTR -> 'str'
// annotation : BYTE -> 'uint8_t'
// accessPerms : LPCSTR -> 'str'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("MSAJApi.dll", {
  alljoyn_interfacedescription_addsignal: { parameters: ["isize", "buffer", "buffer", "buffer", "u8", "buffer"], result: "i32" },
});
// lib.symbols.alljoyn_interfacedescription_addsignal(iface, name, sig, argNames, annotation, accessPerms)
// iface : alljoyn_interfacedescription -> "isize"
// name : LPCSTR -> "buffer"
// sig : LPCSTR -> "buffer"
// argNames : LPCSTR -> "buffer"
// annotation : BYTE -> "u8"
// accessPerms : LPCSTR -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t alljoyn_interfacedescription_addsignal(
    intptr_t iface,
    const char* name,
    const char* sig,
    const char* argNames,
    uint8_t annotation,
    const char* accessPerms);
C, "MSAJApi.dll");
// $ffi->alljoyn_interfacedescription_addsignal(iface, name, sig, argNames, annotation, accessPerms);
// iface : alljoyn_interfacedescription
// name : LPCSTR
// sig : LPCSTR
// argNames : LPCSTR
// annotation : BYTE
// accessPerms : LPCSTR
// 構造体/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_addsignal(
        long iface,   // alljoyn_interfacedescription
        String name,   // LPCSTR
        String sig,   // LPCSTR
        String argNames,   // LPCSTR
        byte annotation,   // BYTE
        String accessPerms   // LPCSTR
    );
}
@[Link("msajapi")]
lib LibMSAJApi
  fun alljoyn_interfacedescription_addsignal = alljoyn_interfacedescription_addsignal(
    iface : LibC::SSizeT,   # alljoyn_interfacedescription
    name : UInt8*,   # LPCSTR
    sig : UInt8*,   # LPCSTR
    argNames : UInt8*,   # LPCSTR
    annotation : UInt8,   # BYTE
    accessPerms : UInt8*   # LPCSTR
  ) : 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_addsignalNative = Int32 Function(IntPtr, Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>, Uint8, Pointer<Utf8>);
typedef alljoyn_interfacedescription_addsignalDart = int Function(int, Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>, int, Pointer<Utf8>);
final alljoyn_interfacedescription_addsignal = DynamicLibrary.open('MSAJApi.dll')
    .lookupFunction<alljoyn_interfacedescription_addsignalNative, alljoyn_interfacedescription_addsignalDart>('alljoyn_interfacedescription_addsignal');
// iface : alljoyn_interfacedescription -> IntPtr
// name : LPCSTR -> Pointer<Utf8>
// sig : LPCSTR -> Pointer<Utf8>
// argNames : LPCSTR -> Pointer<Utf8>
// annotation : BYTE -> Uint8
// accessPerms : LPCSTR -> Pointer<Utf8>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function alljoyn_interfacedescription_addsignal(
  iface: NativeInt;   // alljoyn_interfacedescription
  name: PAnsiChar;   // LPCSTR
  sig: PAnsiChar;   // LPCSTR
  argNames: PAnsiChar;   // LPCSTR
  annotation: Byte;   // BYTE
  accessPerms: PAnsiChar   // LPCSTR
): Integer; stdcall;
  external 'MSAJApi.dll' name 'alljoyn_interfacedescription_addsignal';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "alljoyn_interfacedescription_addsignal"
  c_alljoyn_interfacedescription_addsignal :: CIntPtr -> CString -> CString -> CString -> Word8 -> CString -> IO Int32
-- iface : alljoyn_interfacedescription -> CIntPtr
-- name : LPCSTR -> CString
-- sig : LPCSTR -> CString
-- argNames : LPCSTR -> CString
-- annotation : BYTE -> Word8
-- accessPerms : LPCSTR -> CString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let alljoyn_interfacedescription_addsignal =
  foreign "alljoyn_interfacedescription_addsignal"
    (intptr_t @-> string @-> string @-> string @-> uint8_t @-> string @-> returning int32_t)
(* iface : alljoyn_interfacedescription -> intptr_t *)
(* name : LPCSTR -> string *)
(* sig : LPCSTR -> string *)
(* argNames : LPCSTR -> string *)
(* annotation : BYTE -> uint8_t *)
(* accessPerms : LPCSTR -> string *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library msajapi (t "MSAJApi.dll"))
(cffi:use-foreign-library msajapi)

(cffi:defcfun ("alljoyn_interfacedescription_addsignal" alljoyn-interfacedescription-addsignal :convention :stdcall) :int32
  (iface :int64)   ; alljoyn_interfacedescription
  (name :string)   ; LPCSTR
  (sig :string)   ; LPCSTR
  (arg-names :string)   ; LPCSTR
  (annotation :uint8)   ; BYTE
  (access-perms :string))   ; LPCSTR
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $alljoyn_interfacedescription_addsignal = Win32::API::More->new('MSAJApi',
    'int alljoyn_interfacedescription_addsignal(LPARAM iface, LPCSTR name, LPCSTR sig, LPCSTR argNames, BYTE annotation, LPCSTR accessPerms)');
# my $ret = $alljoyn_interfacedescription_addsignal->Call($iface, $name, $sig, $argNames, $annotation, $accessPerms);
# iface : alljoyn_interfacedescription -> LPARAM
# name : LPCSTR -> LPCSTR
# sig : LPCSTR -> LPCSTR
# argNames : LPCSTR -> LPCSTR
# annotation : BYTE -> BYTE
# accessPerms : LPCSTR -> LPCSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型