diff options
Diffstat (limited to 'ide/ide_win32_stubs.c')
-rw-r--r-- | ide/ide_win32_stubs.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/ide/ide_win32_stubs.c b/ide/ide_win32_stubs.c new file mode 100644 index 000000000..694f1c6a0 --- /dev/null +++ b/ide/ide_win32_stubs.c @@ -0,0 +1,18 @@ +#include <caml/mlvalues.h> +#include <caml/memory.h> +#include <windows.h> + +/* Win32 emulation of kill -9 */ + +/* The pid returned by Unix.create_process is actually a pseudo-pid, + made via a cast of the obtained HANDLE, (cf. win32unix/createprocess.c + in the sources of ocaml). Since we're still in the caller process, + we simply cast back to get an handle... + The 0 is the exit code we want for the terminated process. +*/ + +CAMLprim value win32_kill(value pid) { + CAMLparam1(pid); + TerminateProcess((HANDLE)(Long_val(pid)), 0); + CAMLreturn(Val_unit); +} |