From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA17331 for caml-redistribution; Sun, 14 Feb 1999 23:31:13 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA00628 for ; Sun, 14 Feb 1999 20:36:37 +0100 (MET) Received: from pegasus.azstarnet.com (pegasus.azstarnet.com [169.197.56.194]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id UAA15824 for ; Sun, 14 Feb 1999 20:36:35 +0100 (MET) Received: from dylan (dialup15ip072.tus.azstarnet.com [169.197.37.72]) by pegasus.azstarnet.com (8.9.1a/8.9.1a) with SMTP id MAA18470 for ; Sun, 14 Feb 1999 12:36:18 -0700 (MST) X-Sent-via: StarNet http://www.azstarnet.com/ Message-ID: <001901be5851$6f7ef8a0$210148bf@dylan> From: "David McClain" To: "Liste CAML" Subject: Simple augmentation of reader allows MS Graphics... Date: Sun, 14 Feb 1999 12:37:17 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Sender: weis It is well known that Win32 console mode I/O blocks the event loop for graphics threads. A simple external augmentation of read() allows new OCAML toplevels to perform Window Graphics, without recompiling or altering the runtime system. Microsoft has graciously named their I/O primitive "_read( )" so that we can create our own "read( )" routine to intercept uses of it at link time, substituting our own version that in turn calls the C runtime primitive "_read( )" when it is more appropriate -- such as from another thread. This allows up to pump message queues in the main thread, and to start up other graphics threads without the problems normally encountered by a blocking "read( )". You can get some sample code at http://www.azstarnet.com/~dmcclain/graphics.cpp This code includes the augmented "read( )" routine, a separate console reader thread, and a separate graphics thread that puts up a simple window with some imagery. This code can be compiled and used ahead of the C runtime libraries in the link command of "ocamlmktop" to create new toplevels that enable Win32 graphics. David McClain Sr. Scientist Raytheon Missile Systems Co. Tucson, AZ http://www.azstarnet.com/~dmcclain/homepage.htm