unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: David PONCE <david.ponce@wanadoo.fr>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: Issues with Windows gcc -mno-cygwin (Mingw)
Date: Wed, 19 Mar 2003 08:39:40 +0100 (CET)	[thread overview]
Message-ID: <32603294.1048059580273.JavaMail.www@wwinf0502> (raw)

Hi Jason,

>>- Problem with _fmode (global MSC variable set to O_BINARY as the
>>  default file mode).  For a simple patch see below.  Strictly
>>  speaking I think the real problem is that this is not handled
>>  without the _fmode hack.  The code should just use its own global
>>  variable (or even more simply just add O_BINARY everywhere) instead
>>  of using this brittle compiler/runtime dependent solution.
> 
> 
> I don't understand what problem this is fixing. Can you explain some
> more?

I use latest versions of native mingw tools (not through cygwin):

- gcc 3.2.2 (mingw special 20030208-1)
- binutils 2.13.90-20030111-1
- mingw-runtime 2.4
- w32api 2.2

I also encountered that problem, with latest versions of the
mingw-runtime (2.3, 2.4).

Since these versions, the default runtime _fmode is text mode.
Because of that, I noticed that Emacs incorrectly reads some data,
and I got runtime errors, particularly in the function
"get_doc_string" in doc.c.

I followed the examples given by the mingw team, and did the
following patch, that I put in sysdep.c.  Since that, my Emacs works
like a charm!

Notice that I had to do the same thing with the latest pretest
21.2.95, to fix similar problems.

Hope it will help.
David

Index: src/sysdep.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/sysdep.c,v
retrieving revision 1.248
diff -c -r1.248 sysdep.c
*** src/sysdep.c	4 Feb 2003 14:03:13 -0000	1.248
--- src/sysdep.c	19 Mar 2003 07:29:14 -0000
***************
*** 3231,3236 ****
--- 3231,3248 ----
  #endif /* not WINDOWSNT */
  #endif /* ! HAVE_STRERROR */
  \f
+ /*
+   Since version 2.3 mingw-runtime default IO mode is textmode.
+   That causes invalid data to be read by Emacs, which in turn causes
+   various execution failures.  Changing default runtime IO mode to
+   binary, when mingw-runtime is > 2.2, avoid that.
+ */
+ #if defined(WINDOWSNT) && defined (__MINGW32__) \
+   && __MINGW32_MAJOR_VERSION >= 2 && __MINGW32_MINOR_VERSION > 2
+ #include <fcntl.h>              /* _O_BINARY */
+ int _CRT_fmode = _O_BINARY;
+ #endif
+ 
  int
  emacs_open (path, oflag, mode)
       const char *path;

             reply	other threads:[~2003-03-19  7:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-19  7:39 David PONCE [this message]
2003-03-19  8:41 ` Issues with Windows gcc -mno-cygwin (Mingw) Jason Rumney
2003-03-19 23:44   ` Benjamin Riefenstahl
2003-03-19 23:40 ` Benjamin Riefenstahl
  -- strict thread matches above, loose matches on Subject: below --
2003-05-14  7:27 David PONCE
2003-03-19  9:29 David PONCE
2003-03-18 17:14 Benjamin Riefenstahl
2003-03-18 17:54 ` Eli Zaretskii
2003-03-19 23:31   ` Benjamin Riefenstahl
2003-03-20  4:30     ` Eli Zaretskii
2003-03-20  8:29     ` Jason Rumney
2003-03-20 16:21       ` Benjamin Riefenstahl
2003-03-18 18:26 ` Jason Rumney
2003-03-19 23:36   ` Benjamin Riefenstahl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=32603294.1048059580273.JavaMail.www@wwinf0502 \
    --to=david.ponce@wanadoo.fr \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).