JsSetCurrentContext
関数現在のスクリプト実行コンテキストを設定する。
シグネチャ
// chakra.dll
#include <windows.h>
JsErrorCode JsSetCurrentContext(
void* context
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| context | void* | in |
戻り値の型: JsErrorCode
各言語での呼び出し定義
// chakra.dll
#include <windows.h>
JsErrorCode JsSetCurrentContext(
void* context
);[DllImport("chakra.dll", ExactSpelling = true)]
static extern uint JsSetCurrentContext(
IntPtr context // void*
);<DllImport("chakra.dll", ExactSpelling:=True)>
Public Shared Function JsSetCurrentContext(
context As IntPtr ' void*
) As UInteger
End Function' context : void*
Declare PtrSafe Function JsSetCurrentContext Lib "chakra" ( _
ByVal context As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
JsSetCurrentContext = ctypes.windll.chakra.JsSetCurrentContext
JsSetCurrentContext.restype = wintypes.DWORD
JsSetCurrentContext.argtypes = [
ctypes.POINTER(None), # context : void*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('chakra.dll')
JsSetCurrentContext = Fiddle::Function.new(
lib['JsSetCurrentContext'],
[
Fiddle::TYPE_VOIDP, # context : void*
],
-Fiddle::TYPE_INT)#[link(name = "chakra")]
extern "system" {
fn JsSetCurrentContext(
context: *mut () // void*
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("chakra.dll")]
public static extern uint JsSetCurrentContext(IntPtr context);
"@
$api = Add-Type -MemberDefinition $sig -Name 'chakra_JsSetCurrentContext' -Namespace Win32 -PassThru
# $api::JsSetCurrentContext(context)#uselib "chakra.dll"
#func global JsSetCurrentContext "JsSetCurrentContext" sptr
; JsSetCurrentContext context ; 戻り値は stat
; context : void* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "chakra.dll"
#cfunc global JsSetCurrentContext "JsSetCurrentContext" sptr
; res = JsSetCurrentContext(context)
; context : void* -> "sptr"; JsErrorCode JsSetCurrentContext(void* context)
#uselib "chakra.dll"
#cfunc global JsSetCurrentContext "JsSetCurrentContext" intptr
; res = JsSetCurrentContext(context)
; context : void* -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
chakra = windows.NewLazySystemDLL("chakra.dll")
procJsSetCurrentContext = chakra.NewProc("JsSetCurrentContext")
)
// context (void*)
r1, _, err := procJsSetCurrentContext.Call(
uintptr(context),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // JsErrorCodefunction JsSetCurrentContext(
context: Pointer // void*
): DWORD; stdcall;
external 'chakra.dll' name 'JsSetCurrentContext';result := DllCall("chakra\JsSetCurrentContext"
, "Ptr", context ; void*
, "UInt") ; return: JsErrorCode●JsSetCurrentContext(context) = DLL("chakra.dll", "dword JsSetCurrentContext(void*)")
# 呼び出し: JsSetCurrentContext(context)
# context : void* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。