[comp.sys.amiga] Linking amiga.lib before lc.lib

rouaix@inria.UUCP (Francois Rouaix) (10/22/87)

	We all know by now that it's much better to link with amiga.lib
before the compiler.lib.
I'd like to know if the functions in amiga.lib (fprintf, fgetc, ...) 
behave exactly like C functions (argument passing in stack, error codes ...).
I couldn't find any mention of this in RKM, and the only way I know
to get all pseudo-C functions in amiga.lib is to PrintA amiga.lib
and search for the name _function.
	Any ideas ?
-- 

*- Francois Rouaix                    /       When the going gets tough,     *
*- USENET:rouaix@inria.inria.fr     \/            the guru goes meditating...*
*  SYSOP of Sgt. Flam's Lonely Amigas Club. (33) (1) 39-55-84-59 (Videotext) *

cmcmanis%pepper@Sun.COM (Chuck McManis) (10/23/87)

In article <561@inria.UUCP> (Francois Rouaix) writes:
>	We all know by now that it's much better to link with amiga.lib
>before the compiler.lib.
>I'd like to know if the functions in amiga.lib (fprintf, fgetc, ...) 
>behave exactly like C functions (argument passing in stack, error codes ...).
>I couldn't find any mention of this in RKM, and the only way I know
>to get all pseudo-C functions in amiga.lib is to PrintA amiga.lib
>and search for the name _function.

In the AutoDocs (available from C/A for $20 as part of the Native Developers
Upgrade Disk from CATS,  1200 Wilson Dr, West Chester, PA) there is some
fairly complete documentation on the C type functions that are available
in Amiga.Lib. Be forewarned however that they do not use a compatible 
stdio pointer (FILE *) that Lattice uses. So to use these functions with
Lattice, the following steps must be taken :
    o Link with TWStartup.o rather than c.o. This opens stdin and stdout
	with C/A style file handles rather than Lattice file handles.
    o Link first with *just* Amiga.lib and make sure that you haven't
	used any of Lattice's routines that depend on stdin or stdout.
    o Then link with Amiga.lib first, and LC.lib second. 

When using these routines note that they expect 16 bit ints for such things
as the %d format so if you print a Lattice int use %ld as the format specifier.
Also C/A's printf does not support floating point formats that I know of.


--Chuck McManis
uucp: {anywhere}!sun!cmcmanis   BIX: cmcmanis  ARPAnet: cmcmanis@sun.com
These opinions are my own and no one elses, but you knew that didn't you.