home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 14 Text / 14-Text.zip / borlan.txt < prev    next >
Text File  |  1994-03-14  |  2KB  |  52 lines

  1. Switches and options for writing OS/2 device drivers with Borland C  
  2. 3.1 and 4.0C, courtesy of Rich Peters, 76236,2554
  3.  
  4. -3 -A- -c -f- -K -ms! -pr -R -O -Oabcilpvs-t -y -z
  5.  
  6. This gives you 386 small model code, SS!=DS, and register calling 
  7. conventions. Also, this is pretty aggressive optimization, so volatile 
  8. must be used for testing things like the done bit, etc. BC 3.1 has a bug 
  9. with long parameters and register calling conventions, so I prototype 
  10. any function with a long param for the first two parameters as pascal. 
  11. (long means 32-bit length, not a C type). BC4 doesn't have this bug, 
  12. but it doesn't do 32-bit multiplies or divides, so I don't use it.
  13.  
  14. For the Microsoft 8.00 compiler:
  15.  
  16. /AS /Gs /Oacilntw /Apl /f- /G3r
  17.  
  18. This gives you 386 small model code, SS!=DS, 1 byte packing, and 
  19. register calling conventions. Again, volatile must be used for testing 
  20. things like the done bit, etc. You will get missing externals for 
  21. _anulmul, etc., but these are bogus, as they are never called. You 
  22. could link with the MSC 6.0 SLIBCEP to get rid of them, or stub 
  23. them out with int 3's, as I do.
  24.  
  25. With either compiler, turning on any sort of global optimization kills 
  26. your DD, so I never use these. The above optimizations are the most I 
  27. can turn on with my DDs and still have them work.
  28.  
  29. I use a short assembler stub first to get the segments in the correct 
  30. order:
  31.  
  32. _DATA    segment    dword    public    'DATA'    
  33. _DATA    ends
  34.  
  35. CONST    segment    dword    public    'CONST'
  36. CONST    ends
  37.  
  38. _BSS        segment    dword public 'BSS'
  39. _BSS        ends
  40.  
  41. _ALGN    segment    para    public    'CODE'
  42. _ALGN    ends
  43.  
  44. _TEXT    segment    public    'CODE'
  45. _TEXT    ends
  46.  
  47. EndCode    segment    public    'CODE'
  48. EndCode    ends
  49.  
  50.  
  51.  
  52.