Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!mcgill-vision!snorkelwacker!apple!motcsd!mcdcup!mcdchg!tellab5!mtcchi!thj From: thj@mtcchi.uucp (XT0221000-Tom Hjellming(ZG90210)0000) Newsgroups: comp.os.msdos.programmer Subject: Re: Which C compiler ? Message-ID: <1990Jul16.144459.1913@mtcchi.uucp> Date: 16 Jul 90 14:44:59 GMT References: <2622@nisca.ircc.ohio-state.edu> <7871@dell.dell.com> Organization: Memorex Telex Corporation NSBG/STP Lines: 37 chrisw@dell.dell.com (Chris Waldren) writes: >I am about to write a device driver. I was wondering if there is any way to >do this from C perferable Microsoft C. I'd appreciate any suggestions. >Thanks in advance Yes. I have done a couple of device drivers in C (MS-C even). You will need some assembly language glue though. Basically, the assembly language glue will need to handle the driver header declaration stuff and the Strategy and Interrupt call entry points. Be sure to setup the proper C environment in addition to switching to a private stack. The final executable will need to be in binary or .SYS format. Run EXE2BIN to generate the final executable. EXE2BIN is pretty picky about segment fixups and things like that. You'll have to muck with the segment definitions to get them to fit in the same group. Also, be very careful about using any C run-time functions. Some of them cause the C startup code to be dragged in which will totally screw up your segment ordering and cause EXE2BIN to fail. In general, I found it easier to re-write the C run-time functions than to try to use the ones with the Compiler. A while ago there was a public domain/shareware package floating around the BBSs that was written for Lattice C. I wrote a similar package for MS-C. It handles pretty much all the assembler stuff for you. Your C portion just supplies functions like Init, Read, Write, IOCtl, etc that is linked with the assembler stuff. I think I still have it at home. Send me e-mail if you are interested. Hope this helps. Tom Hjellming Software Consultant Analysts International Corp (AiC) Schaumburg, IL ...!uunet!tellab5!mtcchi!thj