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

JsStopProfiling

関数
スクリプトエンジンのプロファイリングを停止する。
DLLchakra.dll呼出規約winapi

シグネチャ

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

JsErrorCode JsStopProfiling(
    HRESULT reason
);

パラメーター

名前方向説明
reasonHRESULTinプロファイリングを停止する理由を示すHRESULT。正常終了はS_OK。

戻り値の型: JsErrorCode

各言語での呼び出し定義

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

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

JsStopProfiling = ctypes.windll.chakra.JsStopProfiling
JsStopProfiling.restype = wintypes.DWORD
JsStopProfiling.argtypes = [
    ctypes.c_int,  # reason : HRESULT
]
require 'fiddle'
require 'fiddle/import'

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

var (
	chakra = windows.NewLazySystemDLL("chakra.dll")
	procJsStopProfiling = chakra.NewProc("JsStopProfiling")
)

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

extern "chakra" fn JsStopProfiling(
    reason: i32 // HRESULT
) callconv(std.os.windows.WINAPI) u32;
proc JsStopProfiling(
    reason: int32  # HRESULT
): uint32 {.importc: "JsStopProfiling", stdcall, dynlib: "chakra.dll".}
pragma(lib, "chakra");
extern(Windows)
uint JsStopProfiling(
    int reason   // HRESULT
);
ccall((:JsStopProfiling, "chakra.dll"), stdcall, UInt32,
      (Int32,),
      reason)
# reason : HRESULT -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t JsStopProfiling(
    int32_t reason);
]]
local chakra = ffi.load("chakra")
-- chakra.JsStopProfiling(reason)
-- reason : HRESULT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('chakra.dll');
const JsStopProfiling = lib.func('__stdcall', 'JsStopProfiling', 'uint32_t', ['int32_t']);
// JsStopProfiling(reason)
// reason : HRESULT -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("chakra.dll", {
  JsStopProfiling: { parameters: ["i32"], result: "u32" },
});
// lib.symbols.JsStopProfiling(reason)
// reason : HRESULT -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t JsStopProfiling(
    int32_t reason);
C, "chakra.dll");
// $ffi->JsStopProfiling(reason);
// reason : HRESULT
// 構造体/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 JsStopProfiling(
        int reason   // HRESULT
    );
}
@[Link("chakra")]
lib Libchakra
  fun JsStopProfiling = JsStopProfiling(
    reason : Int32   # HRESULT
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef JsStopProfilingNative = Uint32 Function(Int32);
typedef JsStopProfilingDart = int Function(int);
final JsStopProfiling = DynamicLibrary.open('chakra.dll')
    .lookupFunction<JsStopProfilingNative, JsStopProfilingDart>('JsStopProfiling');
// reason : HRESULT -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function JsStopProfiling(
  reason: Integer   // HRESULT
): DWORD; stdcall;
  external 'chakra.dll' name 'JsStopProfiling';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "JsStopProfiling"
  c_JsStopProfiling :: Int32 -> IO Word32
-- reason : HRESULT -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let jsstopprofiling =
  foreign "JsStopProfiling"
    (int32_t @-> returning uint32_t)
(* reason : HRESULT -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library chakra (t "chakra.dll"))
(cffi:use-foreign-library chakra)

(cffi:defcfun ("JsStopProfiling" js-stop-profiling :convention :stdcall) :uint32
  (reason :int32))   ; HRESULT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $JsStopProfiling = Win32::API::More->new('chakra',
    'DWORD JsStopProfiling(int reason)');
# my $ret = $JsStopProfiling->Call($reason);
# reason : HRESULT -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型