Win32 API 日本語リファレンス
ホームSystem.Js › JsGetRuntime

JsGetRuntime

関数
コンテキストが属するランタイムを取得する。
DLLchakra.dll呼出規約winapi

シグネチャ

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

JsErrorCode JsGetRuntime(
    void* context,
    void** runtime
);

パラメーター

名前方向
contextvoid*in
runtimevoid**out

戻り値の型: JsErrorCode

各言語での呼び出し定義

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

JsErrorCode JsGetRuntime(
    void* context,
    void** runtime
);
[DllImport("chakra.dll", ExactSpelling = true)]
static extern uint JsGetRuntime(
    IntPtr context,   // void*
    IntPtr runtime   // void** out
);
<DllImport("chakra.dll", ExactSpelling:=True)>
Public Shared Function JsGetRuntime(
    context As IntPtr,   ' void*
    runtime As IntPtr   ' void** out
) As UInteger
End Function
' context : void*
' runtime : void** out
Declare PtrSafe Function JsGetRuntime Lib "chakra" ( _
    ByVal context As LongPtr, _
    ByVal runtime As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

JsGetRuntime = ctypes.windll.chakra.JsGetRuntime
JsGetRuntime.restype = wintypes.DWORD
JsGetRuntime.argtypes = [
    ctypes.POINTER(None),  # context : void*
    ctypes.c_void_p,  # runtime : void** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('chakra.dll')
JsGetRuntime = Fiddle::Function.new(
  lib['JsGetRuntime'],
  [
    Fiddle::TYPE_VOIDP,  # context : void*
    Fiddle::TYPE_VOIDP,  # runtime : void** out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "chakra")]
extern "system" {
    fn JsGetRuntime(
        context: *mut (),  // void*
        runtime: *mut *mut ()  // void** out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("chakra.dll")]
public static extern uint JsGetRuntime(IntPtr context, IntPtr runtime);
"@
$api = Add-Type -MemberDefinition $sig -Name 'chakra_JsGetRuntime' -Namespace Win32 -PassThru
# $api::JsGetRuntime(context, runtime)
#uselib "chakra.dll"
#func global JsGetRuntime "JsGetRuntime" sptr, sptr
; JsGetRuntime context, runtime   ; 戻り値は stat
; context : void* -> "sptr"
; runtime : void** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "chakra.dll"
#cfunc global JsGetRuntime "JsGetRuntime" sptr, sptr
; res = JsGetRuntime(context, runtime)
; context : void* -> "sptr"
; runtime : void** out -> "sptr"
; JsErrorCode JsGetRuntime(void* context, void** runtime)
#uselib "chakra.dll"
#cfunc global JsGetRuntime "JsGetRuntime" intptr, intptr
; res = JsGetRuntime(context, runtime)
; context : void* -> "intptr"
; runtime : void** out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	chakra = windows.NewLazySystemDLL("chakra.dll")
	procJsGetRuntime = chakra.NewProc("JsGetRuntime")
)

// context (void*), runtime (void** out)
r1, _, err := procJsGetRuntime.Call(
	uintptr(context),
	uintptr(runtime),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // JsErrorCode
function JsGetRuntime(
  context: Pointer;   // void*
  runtime: Pointer   // void** out
): DWORD; stdcall;
  external 'chakra.dll' name 'JsGetRuntime';
result := DllCall("chakra\JsGetRuntime"
    , "Ptr", context   ; void*
    , "Ptr", runtime   ; void** out
    , "UInt")   ; return: JsErrorCode
●JsGetRuntime(context, runtime) = DLL("chakra.dll", "dword JsGetRuntime(void*, void*)")
# 呼び出し: JsGetRuntime(context, runtime)
# context : void* -> "void*"
# runtime : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。