From: Mike McCarty (jmccarty_at_ssd.usa.alcatel.com)
Date: 2001-08-15 20:15:21
On Wed, 15 Aug 2001, Keates, Mark wrote: > (I'm losing it... replying to myself ;-) > > > DrawLine(x1,y1,x2,y2) > > { > > switch (getsystype()) > > { > > case SYS_ATARI: atari_DrawLine(x1,y1,x2,y2); break; > > case SYS_CBM64: cbm64_DrawLine(x1,y1,x2,y2); break; > > ... > > } > > } > > > > I guess this could work if each function was in its own .o file. > > Does LD65 handle this? > > This isn't possible because the DrawLine function HAS a reference > to each implementation and so everything will be linked. > > Therefore you DO need to build a lib for each target. > > Therefore I think Mike's argument of fgets() not having the same > implementation on Sun/Solaris as on the 6502 is immaterial as > the host would never link with the other's library. > > Mark My point was that the term "library" means simply that a bunch of stuff is put into one repository, and has *nothing* to do with the implementation. One could, in building a program, put his special particular main() function into a library. I was addressing the comment that perhaps the term "library" should be dropped from the discussion, and the word "interface" substituted for it. Now, if we want to discuss trying to build a common library which would work for all targets, that seems simple to me. When compiling for any given target, one would pass the compiler the name of the target. This could be done via define. Then the include file would generate macros for each interface which expand to different names based on the intended target. No magic here. And no run-time decisions. The linker simply does its job, no special mods needed. This type of thing is routinely done on other machines, though not always with macros. For example, the Borland compilers allow one to use hardware floating point, or one of two different software floating point emulations (one completely compatible, one faster). On the VAX, one can choose the size of double by means of a switch. I'm not sure it is desirable to build a single library which would work for all targets. One library per target seems reasonable to me. Well, one library per target for each library. One might want a separate graphics library, and not put the graphics code into the common library. This is the usual case for UNIX-like systems, which segregate the math library, for example. Mike -- char *p="char *p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);} This message made from 100% recycled bits. I can explain it for you, but I can't understand it for you. I don't speak for Alcatel <- They make me say that. ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo_at_musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.
This archive was generated by hypermail 2.1.3 : 2001-12-14 22:05:41 CET