From 1e664b94467a65841e63d2dea50cd1f64e8a3258 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Wed, 3 Sep 1997 14:38:02 +0000 Subject: Implementation du type file_descr par le type HANDLE de Win32. Court-circuite la libc de MSVC. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1700 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 --- otherlibs/win32unix/dup.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 otherlibs/win32unix/dup.c (limited to 'otherlibs/win32unix/dup.c') diff --git a/otherlibs/win32unix/dup.c b/otherlibs/win32unix/dup.c new file mode 100644 index 000000000..95f517e95 --- /dev/null +++ b/otherlibs/win32unix/dup.c @@ -0,0 +1,28 @@ +/***********************************************************************/ +/* */ +/* Objective Caml */ +/* */ +/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ +/* */ +/* Copyright 1996 Institut National de Recherche en Informatique et */ +/* Automatique. Distributed only by permission. */ +/* */ +/***********************************************************************/ + +/* $Id$ */ + +#include +#include "unixsupport.h" + +value unix_dup(value fd) /* ML */ +{ + HANDLE newh; + if (! DuplicateHandle(GetCurrentProcess(), Handle_val(fd), + GetCurrentProcess(), &newh, + 0L, inherit, DUPLICATE_SAME_ACCESS)) { + _dosmaperr(GetLastError()); + return -1; + } + return win_alloc_handle(newh); +} + -- cgit v1.2.3-70-g09d2