JsHasException
関数ランタイムに未処理の例外があるかどうかを判定する。
シグネチャ
// chakra.dll
#include <windows.h>
JsErrorCode JsHasException(
BOOLEAN* hasException
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hasException | BOOLEAN* | out |
戻り値の型: JsErrorCode
各言語での呼び出し定義
// chakra.dll
#include <windows.h>
JsErrorCode JsHasException(
BOOLEAN* hasException
);[DllImport("chakra.dll", ExactSpelling = true)]
static extern uint JsHasException(
out byte hasException // BOOLEAN* out
);<DllImport("chakra.dll", ExactSpelling:=True)>
Public Shared Function JsHasException(
<Out> ByRef hasException As Byte ' BOOLEAN* out
) As UInteger
End Function' hasException : BOOLEAN* out
Declare PtrSafe Function JsHasException Lib "chakra" ( _
ByRef hasException As Byte) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
JsHasException = ctypes.windll.chakra.JsHasException
JsHasException.restype = wintypes.DWORD
JsHasException.argtypes = [
ctypes.POINTER(ctypes.c_byte), # hasException : BOOLEAN* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('chakra.dll')
JsHasException = Fiddle::Function.new(
lib['JsHasException'],
[
Fiddle::TYPE_VOIDP, # hasException : BOOLEAN* out
],
-Fiddle::TYPE_INT)#[link(name = "chakra")]
extern "system" {
fn JsHasException(
hasException: *mut u8 // BOOLEAN* out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("chakra.dll")]
public static extern uint JsHasException(out byte hasException);
"@
$api = Add-Type -MemberDefinition $sig -Name 'chakra_JsHasException' -Namespace Win32 -PassThru
# $api::JsHasException(hasException)#uselib "chakra.dll"
#func global JsHasException "JsHasException" sptr
; JsHasException varptr(hasException) ; 戻り値は stat
; hasException : BOOLEAN* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "chakra.dll" #cfunc global JsHasException "JsHasException" var ; res = JsHasException(hasException) ; hasException : BOOLEAN* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "chakra.dll" #cfunc global JsHasException "JsHasException" sptr ; res = JsHasException(varptr(hasException)) ; hasException : BOOLEAN* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; JsErrorCode JsHasException(BOOLEAN* hasException) #uselib "chakra.dll" #cfunc global JsHasException "JsHasException" var ; res = JsHasException(hasException) ; hasException : BOOLEAN* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; JsErrorCode JsHasException(BOOLEAN* hasException) #uselib "chakra.dll" #cfunc global JsHasException "JsHasException" intptr ; res = JsHasException(varptr(hasException)) ; hasException : BOOLEAN* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
chakra = windows.NewLazySystemDLL("chakra.dll")
procJsHasException = chakra.NewProc("JsHasException")
)
// hasException (BOOLEAN* out)
r1, _, err := procJsHasException.Call(
uintptr(hasException),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // JsErrorCodefunction JsHasException(
hasException: Pointer // BOOLEAN* out
): DWORD; stdcall;
external 'chakra.dll' name 'JsHasException';result := DllCall("chakra\JsHasException"
, "Ptr", hasException ; BOOLEAN* out
, "UInt") ; return: JsErrorCode●JsHasException(hasException) = DLL("chakra.dll", "dword JsHasException(void*)")
# 呼び出し: JsHasException(hasException)
# hasException : BOOLEAN* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。