From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
To: <gdb-patches@sourceware.org>
Subject: [RFA] mingw port: Allow use of cvs GDB on Windows 95
Date: Sat, 05 Feb 2011 20:38:00 -0000 [thread overview]
Message-ID: <002401cbc574$a8d990e0$fa8cb2a0$@muller@ics-cnrs.unistra.fr> (raw)
In-Reply-To: <000001cbc473$6ef9d120$4ced7360$@muller@ics-cnrs.unistra.fr>
After these checks, I submit now a simpler patch:
if CancelIo is not exported in kernel32, simply don't
do anything instead.
This allows use of current CVS GDB on windows 95 OS.
Is this patch OK?
Pierre Muller
2011-02-05 Pierre Muller <muller@ics.u-strasbg.fr>
Allow use of mingw native on Windows 95 OS.
* src/gdb/ser-mingw.c (CancelIo): New macro for dynamically loaded
DLL entry.
(ser_windows_close): Only call CancelIo if function exists.
(_initialize_ser_windows): Use LoadLirary/GetProcAddress
to check for existence of CancelIo function in kernel32 DLL.
Index: src/gdb/ser-mingw.c
===================================================================
RCS file: /cvs/src/src/gdb/ser-mingw.c,v
retrieving revision 1.26
diff -u -p -r1.26 ser-mingw.c
--- src/gdb/ser-mingw.c 11 Jan 2011 21:53:23 -0000 1.26
+++ src/gdb/ser-mingw.c 5 Feb 2011 17:28:07 -0000
@@ -45,6 +45,13 @@ struct ser_windows_state
HANDLE except_event;
};
+/* CancelIo is not available for Windows 95 OS,
+ so we need to use LoadLibrary/GetProcAddress to avoid
+ a startup failure. */
+#define CancelIo dyn_CancelIo
+
+static BOOL WINAPI (*CancelIo) (HANDLE);
+
/* Open up a real live device for serial I/O. */
static int
@@ -217,7 +224,8 @@ ser_windows_close (struct serial *scb)
struct ser_windows_state *state;
/* Stop any pending selects. */
- CancelIo ((HANDLE) _get_osfhandle (scb->fd));
+ if (CancelIo)
+ CancelIo ((HANDLE) _get_osfhandle (scb->fd));
state = scb->state;
CloseHandle (state->ov.hEvent);
CloseHandle (state->except_event);
@@ -1207,9 +1215,19 @@ _initialize_ser_windows (void)
{
WSADATA wsa_data;
struct serial_ops *ops;
+ HMODULE hm = NULL;
- /* First register the serial port driver. */
+ /* First find out if kernel32 exports CancelIo function. */
+ hm = LoadLibrary ("kernel32.dll");
+ if (hm)
+ {
+ CancelIo = (void *) GetProcAddress (hm, "CancelIo");
+ FreeLibrary (hm);
+ }
+ else
+ CancelIo = NULL;
+ /* Now register the serial port driver. */
ops = XMALLOC (struct serial_ops);
memset (ops, 0, sizeof (struct serial_ops));
ops->name = "hardwire";
next prev parent reply other threads:[~2011-02-05 20:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-04 13:06 [RFC] " Compte ICS
2011-02-04 13:57 ` Pierre Muller
2011-02-05 20:38 ` Pierre Muller [this message]
2011-02-21 11:06 ` [RFA] " Joel Brobecker
2011-02-21 11:58 ` Pierre Muller
2011-02-21 12:52 ` Joel Brobecker
2011-02-21 13:35 ` Pierre Muller
2011-02-21 14:59 ` Joel Brobecker
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='002401cbc574$a8d990e0$fa8cb2a0$@muller@ics-cnrs.unistra.fr' \
--to=pierre.muller@ics-cnrs.unistra.fr \
--cc=gdb-patches@sourceware.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox