home *** CD-ROM | disk | FTP | other *** search
- 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
- From: dak@tabaqui.informatik.rwth-aachen.de (David Kastrup)
- Newsgroups: comp.lang.c++
- Subject: Re: How does one use 68000 subroutines with C++ ???
- Date: 22 Jan 93 00:02:24 GMT
- Organization: Rechnerbetrieb Informatik - RWTH Aachen
- Lines: 32
- Distribution: world
- Message-ID: <dak.727660944@tabaqui>
- References: <C1640F.54y@cs.uiuc.edu> <1993Jan21.101439.16841@cbfsb.cb.att.com>
- NNTP-Posting-Host: tabaqui.informatik.rwth-aachen.de
-
- nh@cbnewsg.cb.att.com (nicholas.hounsome) writes:
-
- >From article <C1640F.54y@cs.uiuc.edu>, by ctaylor@cs.uiuc.edu (Conrad Taylor):
- >> I was wondering , is there anyway to use assembly language
- >> routines with C++? I'm using SunOS operating system with AT&T 2.1
- >> CC compiler (cfront). Thanks in advance to all that reply to this
- >> post.
-
- >The easiest way is to declare them as extern "C" and write them as
- >you would for C.
-
- >Usualy this means A6 is the frame pointer, A0,A1 & D0,D1 are scratch
- >registers and the arguments are pushed onto the stack in reverse order
- >by the caller who removes them after the call. results are usualy
- >returned in D0.
-
- >Almost everyone does it this way except gnu.
-
- You forgot to mention that you CAN do it with gnu as well, of course,
- I mean there is nothing in simply writing a piece of Assembler and linking
- it in.
-
- But GNU has the much more ingenious possibility to intertwine Assembler
- fragments into high level code without call overhead, without getting
- the optimizer tumbling down because he does not know what registers
- you use, and even without worrying about addressing modes, because
- the compiler will fill them in, load them into registers if more
- appropriate. Small wonder GNU programmers almost never take the
- pains of separate assembler modules.
-
- I have yet to see a more convenient, performance penalty free way
- of imbedding assembler.
-