Re: Re[2]: [cc65] Graphics library

Date view Thread view Subject view

From: Arvid Norberg (arvid_at_iname.com)
Date: 2001-08-15 19:55:10


> > 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.
>

Why not have compile-time #ifdefs?
Then DrawLine() will only be compiled in one version, and it will be more
efficient because you don't need to ask what platform you are running on.
Something like:

#ifdef CBM64
DrawLine(x1,y1,x2,y2)
{
    ...
}
#elif ATARI
DrawLine(x1,y1,x2,y2)
{
    ...
}
#elif ...

---
Arvid Norberg

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2001-12-14 22:05:41 CET