Switches and options for writing OS/2 device drivers with Borland C 3.1 and 4.0C, courtesy of Rich Peters, 76236,2554 -3 -A- -c -f- -K -ms! -pr -R -O -Oabcilpvs-t -y -z This gives you 386 small model code, SS!=DS, and register calling conventions. Also, this is pretty aggressive optimization, so volatile must be used for testing things like the done bit, etc. BC 3.1 has a bug with long parameters and register calling conventions, so I prototype any function with a long param for the first two parameters as pascal. (long means 32-bit length, not a C type). BC4 doesn't have this bug, but it doesn't do 32-bit multiplies or divides, so I don't use it. For the Microsoft 8.00 compiler: /AS /Gs /Oacilntw /Apl /f- /G3r This gives you 386 small model code, SS!=DS, 1 byte packing, and register calling conventions. Again, volatile must be used for testing things like the done bit, etc. You will get missing externals for _anulmul, etc., but these are bogus, as they are never called. You could link with the MSC 6.0 SLIBCEP to get rid of them, or stub them out with int 3's, as I do. With either compiler, turning on any sort of global optimization kills your DD, so I never use these. The above optimizations are the most I can turn on with my DDs and still have them work. I use a short assembler stub first to get the segments in the correct order: _DATA segment dword public 'DATA' _DATA ends CONST segment dword public 'CONST' CONST ends _BSS segment dword public 'BSS' _BSS ends _ALGN segment para public 'CODE' _ALGN ends _TEXT segment public 'CODE' _TEXT ends EndCode segment public 'CODE' EndCode ends