Mail Archives: cygwin/1997/01/14/03:18:12
Henry Minsky[SMTP:hqm AT ua DOT com] wrote:
>Does anyone know if mmap is supposed to work under the current (v B
>17.1) cygwin.dll? I get undefined symbol errors when I try to compile
>programs with calls to mmap().
>
>If mmap() has not yet been implemented, I was given an implementation
>called mman.c written by a fellow in Australia, David Makepeace
><D DOT Makepeace AT mailbox DOT uq DOT oz DOT au>, which says it implements mmap using
>the Win32 memory mapping routines.
>
>I cannot compile this version of mmap under gcc on Windows NT,
>however, because it references a function called _get_osfhandle. This
>seems to be defined in the Microsoft LIBC, but not in the gnu-win32
>libraries. Can anyone tell me how to link with this function, or more
>generally how to link with a .lib or other object file produced by
>Mirosoft's compiler?
I know less than nothing about mmap, but I do know something about
_get_osfhandle. The implementation of _get_osfhandle is in CRTDLL.DLL
(the C run time library included with Windows 95 and NT) and you could
fairly easily link a reference to it into your application by creating
and import library for it. In fact you could just grab the relevant
..def file and prototype out of the Minimalist GNU Win-32 files (download
mingw32-0.1.1.tar.gz from
http://www.fu.is.saga-u.ac.jp/~colin/mingw32-download.html and dig out
the relevant information) or you could fairly easily write the necessary
stuff yourself (a very short .def file and a prototype for _get_osfhandle).
Then you could link your application with your new import library and voila, _get_osfhandle will work.
One warning however: crtdll is a full implementation of the C run-time
library, and _get_osfhandle is a fairly low-level non-portable call. This
sends up warning flags in my mind that you may encounter trouble with the
code that uses this function if you use the Cygwin version of the run time
library functions in concert with it... but then again you could be lucky.
It also means that you have to avoid using the import library and/or full
..def file from mingw32 if you don't want all your run time library calls
to be handled by crtdll.dll (which implies basically compiling with mingw32
*instead* of with a "normal" Cygnus/cygwin setup).
Other than these (honestly minor) caveats it shouldn't be too hard.
Good luck,
Colin.
-- Colin Peters - colin AT bird DOT fu DOT is DOT saga-u DOT ac DOT jp
-- Saga University Dept. of Information Science
-- Fundamentals of Information Science
-- http://www.fu.is.saga-u.ac.jp/~colin/home.html
-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -