[openbeos] Re: How not to actively prevent a PPC version of your software and write better code at the same time

  • From: "Scott MacMaster" <zqxh@xxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Tue, 09 Apr 2002 21:04:51 PDT (-0700)

I agree with all your points except for the points about requiring 
_EXPORT on all classes and functions.  Also, I don't see how using them 
or not has any relation to ppc.  There's a similar macro used in 
windows code.  I've also used them.  However, I never used to for cross
-compiling.  I used them when making a DLL to inform the compiler to 
make classes and functions available for programs that want to use 
these functions and classes.  I suspect the use of _EXPORT does the 
same for BeOS with .so files.  From this I can say that you don't need 
to use it with all classes and functions and in some cases some 
probably shouldn't have it.  It should only be used for classes and 
functions that are to be made to users of the BeAPI.  So instead of to 
decide if _EXPORT should be required for everything, I suggest deciding 
on which functions and which classes should be made available to users 
of the BeAPI and require that those classes and functions have _EXPORT.  
This is probably a task for the individual teams.

Scott MacMaster

> >> >I'm trying to compile various pieces of OBOS software for PPC. 
> > > > Here 
> >> > are 
> >> >some quick rules that both create better code and make my life a 
> > > > *
> >> > lot* 
> >> >easier.
> >> >
> >> >1. BEFORE you include your class interface file, do this:
> >> >class _EXPORT MyFooClass.
> >> 
> >> Ugghh. This is *so* ugly. Isn't this a Metrowerks thing? Does GCC 
> > > PPC 
> >> need this?
> >> 
> >> >2. Please put an _EXPORT before all exported global functions, 
> > > > like 
> >> >this:
> >> >_EXPORT status_t MyFooFunction() {
> >> >  DoSomeStuff();
> >> >}
> >> 
> >> Ditto.
> >
> >It may be ugly, but until we are building exclusively on the NewOS 
> >kernel, it is absolutely necessary. Sorry :(
> >-Nathan
> So is it a Metrowerks thing?
> See - I am not sure that I want to ask developers to nastify up their 
> code like this.
> The other things that you pointed out are good style, and I can 100% 
> agree with.
> And having a second compiler like MW is great for that sort of thing.
> But changing the code with cruft like this is not, IMHO, a worthy 
> endeavor.
> I know that makes PPC hard/impossible. I 100% understand that. This 
> is, though, the sort
> of thing that I forsaw when I said that I didn't want to make PPC an 
> "official" piece, right now.
> We would have to buy into a little more legacy than I feel 
> comfortable with.

Other related posts: