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

CorExitProcess

関数
CLRをシャットダウンして現在のプロセスを終了する。
DLLMSCorEE.dll呼出規約winapi

シグネチャ

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

void CorExitProcess(
    INT exitCode
);

パラメーター

名前方向
exitCodeINTin

戻り値の型: void

各言語での呼び出し定義

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

void CorExitProcess(
    INT exitCode
);
[DllImport("MSCorEE.dll", ExactSpelling = true)]
static extern void CorExitProcess(
    int exitCode   // INT
);
<DllImport("MSCorEE.dll", ExactSpelling:=True)>
Public Shared Sub CorExitProcess(
    exitCode As Integer   ' INT
)
End Sub
' exitCode : INT
Declare PtrSafe Sub CorExitProcess Lib "mscoree" ( _
    ByVal exitCode As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CorExitProcess = ctypes.windll.mscoree.CorExitProcess
CorExitProcess.restype = None
CorExitProcess.argtypes = [
    ctypes.c_int,  # exitCode : INT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MSCorEE.dll')
CorExitProcess = Fiddle::Function.new(
  lib['CorExitProcess'],
  [
    Fiddle::TYPE_INT,  # exitCode : INT
  ],
  Fiddle::TYPE_VOID)
#[link(name = "mscoree")]
extern "system" {
    fn CorExitProcess(
        exitCode: i32  // INT
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MSCorEE.dll")]
public static extern void CorExitProcess(int exitCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSCorEE_CorExitProcess' -Namespace Win32 -PassThru
# $api::CorExitProcess(exitCode)
#uselib "MSCorEE.dll"
#func global CorExitProcess "CorExitProcess" sptr
; CorExitProcess exitCode
; exitCode : INT -> "sptr"
#uselib "MSCorEE.dll"
#func global CorExitProcess "CorExitProcess" int
; CorExitProcess exitCode
; exitCode : INT -> "int"
; void CorExitProcess(INT exitCode)
#uselib "MSCorEE.dll"
#func global CorExitProcess "CorExitProcess" int
; CorExitProcess exitCode
; exitCode : INT -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mscoree = windows.NewLazySystemDLL("MSCorEE.dll")
	procCorExitProcess = mscoree.NewProc("CorExitProcess")
)

// exitCode (INT)
r1, _, err := procCorExitProcess.Call(
	uintptr(exitCode),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure CorExitProcess(
  exitCode: Integer   // INT
); stdcall;
  external 'MSCorEE.dll' name 'CorExitProcess';
result := DllCall("MSCorEE\CorExitProcess"
    , "Int", exitCode   ; INT
    , "Int")   ; return: void
●CorExitProcess(exitCode) = DLL("MSCorEE.dll", "int CorExitProcess(int)")
# 呼び出し: CorExitProcess(exitCode)
# exitCode : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。