home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / cplus / 19714 < prev    next >
Encoding:
Internet Message Format  |  1993-01-21  |  1.9 KB

  1. Path: sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!ira.uka.de!Germany.EU.net!urmel.informatik.rwth-aachen.de!tabaqui!dak
  2. From: dak@tabaqui.informatik.rwth-aachen.de (David Kastrup)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: How does one use 68000 subroutines with C++ ???
  5. Date: 22 Jan 93 00:02:24 GMT
  6. Organization: Rechnerbetrieb Informatik - RWTH Aachen
  7. Lines: 32
  8. Distribution: world
  9. Message-ID: <dak.727660944@tabaqui>
  10. References: <C1640F.54y@cs.uiuc.edu> <1993Jan21.101439.16841@cbfsb.cb.att.com>
  11. NNTP-Posting-Host: tabaqui.informatik.rwth-aachen.de
  12.  
  13. nh@cbnewsg.cb.att.com (nicholas.hounsome) writes:
  14.  
  15. >From article <C1640F.54y@cs.uiuc.edu>, by ctaylor@cs.uiuc.edu (Conrad Taylor):
  16. >>          I was wondering , is there anyway to use assembly language
  17. >> routines with C++?  I'm using SunOS operating system with AT&T 2.1
  18. >> CC compiler (cfront).  Thanks in advance to all that reply to this     
  19. >> post.
  20.  
  21. >The easiest way is to declare them as extern "C" and write them as 
  22. >you would for C.
  23.  
  24. >Usualy this means A6 is the frame pointer, A0,A1 & D0,D1 are scratch
  25. >registers and the arguments are pushed onto the stack in reverse order
  26. >by the caller who removes them after the call. results are usualy
  27. >returned in D0. 
  28.  
  29. >Almost everyone does it this way except gnu.
  30.  
  31. You forgot to mention that you CAN do it with gnu as well, of course,
  32. I mean there is nothing in simply writing a piece of Assembler and linking
  33. it in.
  34.  
  35. But GNU has the much more ingenious possibility to intertwine Assembler
  36. fragments into high level code without call overhead, without getting
  37. the optimizer tumbling down because he does not know what registers
  38. you use, and even without worrying about addressing modes, because
  39. the compiler will fill them in, load them into registers if more
  40. appropriate. Small wonder GNU programmers almost never take the
  41. pains of separate assembler modules.
  42.  
  43. I have yet to see a more convenient, performance penalty free way
  44. of imbedding assembler.
  45.