From: Lev Serebryakov <lev@se...> - 2002-10-24 17:14:09
Hello, mspgcc-users! How are you?
I have one question: is result of open() call in mingw32 is
old-good-plain Win32 HANDLE or not? If it IS HANDLE, and we could
write something like this:
hFile = CreateFile(...);
fd = open(...);
then I could prepare patches for collect2.c, so it will be possible
to compile cross-compilers for targets, that needs collect2, with
BTW, here is _pipe() call in MSVCRT.LIB. So... May be, It will be
possible in any case... Is _pipe() supported by mingw32?
| FIDONet: 2:5030/661.0 |
| E-Mail: lev@... |
| Page: http://lev.serebryakov.spb.ru/ |
| ICQ UIN: 3670018 |
| Phone: You know, if you have world nodelist |
From: Tor Lillqvist <tml@ik...> - 2002-10-24 19:02:58
Lev Serebryakov writes:
> I have one question: is result of open() call in mingw32 is
> old-good-plain Win32 HANDLE or not?
No. It is a small nonnegative integer, just like file handles on
Unix. But unlike Unix, it isn't anything that the operating system
itself knows about. It's the Microsoft C runtime that has a
(per-process) table with various data for each such "file handle". For
instance the actual HANDLE in a field in the table. The "file handle"
is the index into that table.
You can't access that table directly, but you can read and set certain
fields of it with some C runtime functions. For instance, you can get
the HANDLE corresponding to a "file handle" with the function
_get_osfhandle(), declared in <io.h>. Or, you create a "file handle"
corresponding to an already open HANDLE using _open_osfhandle().
(This really doesn't have much to do with mingw; this stuff is in the
Microsoft C runtime library msvcrt.dll, and valid for MSVC, too.)
> possible in any case... Is _pipe() supported by mingw32?
Of course. (Not that mingw has to do anything in particular to