JsDeleteProperty
関数オブジェクトの指定プロパティを削除する。
シグネチャ
// chakra.dll
#include <windows.h>
JsErrorCode JsDeleteProperty(
void* object,
void* propertyId,
BYTE useStrictRules,
void** result
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| object | void* | in | プロパティを削除する対象のオブジェクト。 |
| propertyId | void* | in | 削除するプロパティの識別子(JsPropertyIdRef)。 |
| useStrictRules | BYTE | in | 厳格モード(strict)の規則を適用するかの真偽値。0以外で厳格扱い。 |
| result | void** | out | 削除が成功したかを示すBoolean値を受け取るポインタのアドレス。 |
戻り値の型: JsErrorCode
各言語での呼び出し定義
// chakra.dll
#include <windows.h>
JsErrorCode JsDeleteProperty(
void* object,
void* propertyId,
BYTE useStrictRules,
void** result
);[DllImport("chakra.dll", ExactSpelling = true)]
static extern uint JsDeleteProperty(
IntPtr object, // void*
IntPtr propertyId, // void*
byte useStrictRules, // BYTE
IntPtr result // void** out
);<DllImport("chakra.dll", ExactSpelling:=True)>
Public Shared Function JsDeleteProperty(
[object] As IntPtr, ' void*
propertyId As IntPtr, ' void*
useStrictRules As Byte, ' BYTE
result As IntPtr ' void** out
) As UInteger
End Function' object : void*
' propertyId : void*
' useStrictRules : BYTE
' result : void** out
Declare PtrSafe Function JsDeleteProperty Lib "chakra" ( _
ByVal object As LongPtr, _
ByVal propertyId As LongPtr, _
ByVal useStrictRules As Byte, _
ByVal result As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
JsDeleteProperty = ctypes.windll.chakra.JsDeleteProperty
JsDeleteProperty.restype = wintypes.DWORD
JsDeleteProperty.argtypes = [
ctypes.POINTER(None), # object : void*
ctypes.POINTER(None), # propertyId : void*
ctypes.c_ubyte, # useStrictRules : BYTE
ctypes.c_void_p, # result : void** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('chakra.dll')
JsDeleteProperty = Fiddle::Function.new(
lib['JsDeleteProperty'],
[
Fiddle::TYPE_VOIDP, # object : void*
Fiddle::TYPE_VOIDP, # propertyId : void*
-Fiddle::TYPE_CHAR, # useStrictRules : BYTE
Fiddle::TYPE_VOIDP, # result : void** out
],
-Fiddle::TYPE_INT)#[link(name = "chakra")]
extern "system" {
fn JsDeleteProperty(
object: *mut (), // void*
propertyId: *mut (), // void*
useStrictRules: u8, // BYTE
result: *mut *mut () // void** out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("chakra.dll")]
public static extern uint JsDeleteProperty(IntPtr object, IntPtr propertyId, byte useStrictRules, IntPtr result);
"@
$api = Add-Type -MemberDefinition $sig -Name 'chakra_JsDeleteProperty' -Namespace Win32 -PassThru
# $api::JsDeleteProperty(object, propertyId, useStrictRules, result)#uselib "chakra.dll"
#func global JsDeleteProperty "JsDeleteProperty" sptr, sptr, sptr, sptr
; JsDeleteProperty object, propertyId, useStrictRules, result ; 戻り値は stat
; object : void* -> "sptr"
; propertyId : void* -> "sptr"
; useStrictRules : BYTE -> "sptr"
; result : void** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "chakra.dll"
#cfunc global JsDeleteProperty "JsDeleteProperty" sptr, sptr, int, sptr
; res = JsDeleteProperty(object, propertyId, useStrictRules, result)
; object : void* -> "sptr"
; propertyId : void* -> "sptr"
; useStrictRules : BYTE -> "int"
; result : void** out -> "sptr"; JsErrorCode JsDeleteProperty(void* object, void* propertyId, BYTE useStrictRules, void** result)
#uselib "chakra.dll"
#cfunc global JsDeleteProperty "JsDeleteProperty" intptr, intptr, int, intptr
; res = JsDeleteProperty(object, propertyId, useStrictRules, result)
; object : void* -> "intptr"
; propertyId : void* -> "intptr"
; useStrictRules : BYTE -> "int"
; result : void** out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
chakra = windows.NewLazySystemDLL("chakra.dll")
procJsDeleteProperty = chakra.NewProc("JsDeleteProperty")
)
// object (void*), propertyId (void*), useStrictRules (BYTE), result (void** out)
r1, _, err := procJsDeleteProperty.Call(
uintptr(object),
uintptr(propertyId),
uintptr(useStrictRules),
uintptr(result),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // JsErrorCodefunction JsDeleteProperty(
object: Pointer; // void*
propertyId: Pointer; // void*
useStrictRules: Byte; // BYTE
result: Pointer // void** out
): DWORD; stdcall;
external 'chakra.dll' name 'JsDeleteProperty';result := DllCall("chakra\JsDeleteProperty"
, "Ptr", object ; void*
, "Ptr", propertyId ; void*
, "UChar", useStrictRules ; BYTE
, "Ptr", result ; void** out
, "UInt") ; return: JsErrorCode●JsDeleteProperty(object, propertyId, useStrictRules, result) = DLL("chakra.dll", "dword JsDeleteProperty(void*, void*, byte, void*)")
# 呼び出し: JsDeleteProperty(object, propertyId, useStrictRules, result)
# object : void* -> "void*"
# propertyId : void* -> "void*"
# useStrictRules : BYTE -> "byte"
# result : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "chakra" fn JsDeleteProperty(
object: ?*anyopaque, // void*
propertyId: ?*anyopaque, // void*
useStrictRules: u8, // BYTE
result: ?*anyopaque // void** out
) callconv(std.os.windows.WINAPI) u32;proc JsDeleteProperty(
`object`: pointer, # void*
propertyId: pointer, # void*
useStrictRules: uint8, # BYTE
result: pointer # void** out
): uint32 {.importc: "JsDeleteProperty", stdcall, dynlib: "chakra.dll".}pragma(lib, "chakra");
extern(Windows)
uint JsDeleteProperty(
void* object, // void*
void* propertyId, // void*
ubyte useStrictRules, // BYTE
void** result // void** out
);ccall((:JsDeleteProperty, "chakra.dll"), stdcall, UInt32,
(Ptr{Cvoid}, Ptr{Cvoid}, UInt8, Ptr{Cvoid}),
object, propertyId, useStrictRules, result)
# object : void* -> Ptr{Cvoid}
# propertyId : void* -> Ptr{Cvoid}
# useStrictRules : BYTE -> UInt8
# result : void** out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t JsDeleteProperty(
void* object,
void* propertyId,
uint8_t useStrictRules,
void** result);
]]
local chakra = ffi.load("chakra")
-- chakra.JsDeleteProperty(object, propertyId, useStrictRules, result)
-- object : void*
-- propertyId : void*
-- useStrictRules : BYTE
-- result : void** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('chakra.dll');
const JsDeleteProperty = lib.func('__stdcall', 'JsDeleteProperty', 'uint32_t', ['void *', 'void *', 'uint8_t', 'void *']);
// JsDeleteProperty(object, propertyId, useStrictRules, result)
// object : void* -> 'void *'
// propertyId : void* -> 'void *'
// useStrictRules : BYTE -> 'uint8_t'
// result : void** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("chakra.dll", {
JsDeleteProperty: { parameters: ["pointer", "pointer", "u8", "pointer"], result: "u32" },
});
// lib.symbols.JsDeleteProperty(object, propertyId, useStrictRules, result)
// object : void* -> "pointer"
// propertyId : void* -> "pointer"
// useStrictRules : BYTE -> "u8"
// result : void** out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t JsDeleteProperty(
void* object,
void* propertyId,
uint8_t useStrictRules,
void** result);
C, "chakra.dll");
// $ffi->JsDeleteProperty(object, propertyId, useStrictRules, result);
// object : void*
// propertyId : void*
// useStrictRules : BYTE
// result : void** out
// 構造体/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 Chakra extends StdCallLibrary {
Chakra INSTANCE = Native.load("chakra", Chakra.class);
int JsDeleteProperty(
Pointer object, // void*
Pointer propertyId, // void*
byte useStrictRules, // BYTE
Pointer result // void** out
);
}@[Link("chakra")]
lib Libchakra
fun JsDeleteProperty = JsDeleteProperty(
object : Void*, # void*
propertyId : Void*, # void*
useStrictRules : UInt8, # BYTE
result : Void** # void** out
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef JsDeletePropertyNative = Uint32 Function(Pointer<Void>, Pointer<Void>, Uint8, Pointer<Void>);
typedef JsDeletePropertyDart = int Function(Pointer<Void>, Pointer<Void>, int, Pointer<Void>);
final JsDeleteProperty = DynamicLibrary.open('chakra.dll')
.lookupFunction<JsDeletePropertyNative, JsDeletePropertyDart>('JsDeleteProperty');
// object : void* -> Pointer<Void>
// propertyId : void* -> Pointer<Void>
// useStrictRules : BYTE -> Uint8
// result : void** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function JsDeleteProperty(
object: Pointer; // void*
propertyId: Pointer; // void*
useStrictRules: Byte; // BYTE
result: Pointer // void** out
): DWORD; stdcall;
external 'chakra.dll' name 'JsDeleteProperty';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "JsDeleteProperty"
c_JsDeleteProperty :: Ptr () -> Ptr () -> Word8 -> Ptr () -> IO Word32
-- object : void* -> Ptr ()
-- propertyId : void* -> Ptr ()
-- useStrictRules : BYTE -> Word8
-- result : void** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let jsdeleteproperty =
foreign "JsDeleteProperty"
((ptr void) @-> (ptr void) @-> uint8_t @-> (ptr void) @-> returning uint32_t)
(* object : void* -> (ptr void) *)
(* propertyId : void* -> (ptr void) *)
(* useStrictRules : BYTE -> uint8_t *)
(* result : void** out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library chakra (t "chakra.dll"))
(cffi:use-foreign-library chakra)
(cffi:defcfun ("JsDeleteProperty" js-delete-property :convention :stdcall) :uint32
(object :pointer) ; void*
(property-id :pointer) ; void*
(use-strict-rules :uint8) ; BYTE
(result :pointer)) ; void** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $JsDeleteProperty = Win32::API::More->new('chakra',
'DWORD JsDeleteProperty(LPVOID object, LPVOID propertyId, BYTE useStrictRules, LPVOID result)');
# my $ret = $JsDeleteProperty->Call($object, $propertyId, $useStrictRules, $result);
# object : void* -> LPVOID
# propertyId : void* -> LPVOID
# useStrictRules : BYTE -> BYTE
# result : void** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型