Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!cbmvax!carolyn From: carolyn@cbmvax.cbm.UUCP (Carolyn Scheppner) Newsgroups: net.micro.amiga Subject: Re: Linking with my.lib (help!) Message-ID: <830@cbmvax.cbmvax.cbm.UUCP> Date: Fri, 3-Oct-86 10:15:45 EDT Article-I.D.: cbmvax.830 Posted: Fri Oct 3 10:15:45 1986 Date-Received: Sat, 4-Oct-86 12:16:07 EDT References: <546@cubsvax.UUCP> Reply-To: carolyn@cbmvax.UUCP (Carolyn Scheppner) Organization: Commodore Technology, West Chester, PA Lines: 76 In article <546@cubsvax.UUCP> dss@cubsvax.UUCP (David Silver) writes: > >When using the my.lib library, Matt suggests linking with Astartup.obj >rather than Lstartup.obj. Whenever I use Astartup.obj and amiga.lib >(leaving out lc.lib) I get the message: > >Warning: Undefined symbols > __xcovf > __base SOME GENERAL RULES FOR LINKING 1. Full Lattice compile and link Gives you access to all LC.lib functions (fopen, strcmp, etc.) Also gives you a small stdio window on WB startup. This is required if you want to start a program that uses printf(), getchar(), etc from WorkBench. Alink LStartup.obj, your.o TO your.ld LIBRARY LC.lib, Amiga.lib 2. Full Lattice compile and link with no WB startup window First, compile _main.c using the flag -dTINY (means #define TINY) on pass 1 (LC1) of the compiler. Then ... Alink LStartup.obj, _main.o, your.o TO your.ld LIBRARY LC.lib, Amiga.lib 3. Amiga only compile and link No access to LC.lib. No default window on WB startup This is my favorite. (produces much smaller code) You must use the -v flag on pass 2 (LC2) of the compiler when you compile your C modules. This keeps Lattice from adding its stack-checking code to your functions and therefore gets rid of the unresolved external references to __xcovf and __base. Note that you must also use the -v flag when compiling C modules for something that can't have any startup code, for example printer drivers, devices, libraries. You must also write you code so it does not require any functions that are only in LC.lib (i.e. most of the functions in the C manual). Also, don't use any of the lattice/ headers. Amiga.lib contains a number of useful C functions you can use such as printf, sprintf, getchar, putchar, fprintf, fgetc, fputc. (The printf's don't handle floating point) Note that this link will not resolve non-power-of-2 multiplication or division (unresolved _CXM22 and _CXD22 or something like that). If you get these unresolved, use method 4 (below). I usually use direct AmigaDos file functions, write my own string functions, and use Amiga.lib's printf and getchar if needed. Alink AStartup.obj, your.o TO your.ld LIBRARY Amiga.lib 4. Amiga compile and link with LC.lib Same as above but resolves things like non-power-of-2 multiplication and division by pulling in parts of LC.lib. (makes code a bit bigger) Note that some printer drivers require this method (minus the startup code) because their Render routines need the LC.lib math. Write your code as in #3, compile with -v on LC2 and ... Alink AStartup.obj, your.o TO your.ld LIBRARY Amiga.lib, LC.lib ------------------------------------------------------------------------- Hope this clears up some of the confusion. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Carolyn Scheppner -- CBM >>Amiga Technical Support<< UUCP ...{allegra,caip,ihnp4,seismo}!cbmvax!carolyn PHONE 215-431-9180 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=