[openbeos] Re: PPC versions

  • From: "Marcus Overhagen" <dos4gw@xxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Mon, 8 Apr 2002 18:52:06 +0200

(send again, I used a wrong from last time)
"Allen Brunson" <brunsona@xxxxxxxxxxx> wrote:

>Yes, exactly!  It's really ELF that is weird in this respect, exporting
>every symbol by default, NOT other platforms like PPC.  I'm used to seeing
>_EXPORT or something like it in every shared-library-like thing I've ever
>worked on for decades.  If adding a few _EXPORTs here and there to the
>source helps PPC people contribute and work on OpenBeOS, I don't see why
>anybody should object.

I agree. Exporting every symbol is stupid, because you can easily have 
name collisions. Thats why OS internel clases and symbols schould be 
prefixed with a undescore ( _ ), as all symbols with underscore are reserved
for the operationg system vendor (if I'm not wrong). Thats a workaround,
and not exporting every symbol is nicer.

Another issue is the decision of the naming of all variables in a class.
I think it was decided to prefix all with an f, thats not bad, as long as no one
currently using BeOs also has the same variable name in a derived class.
I think this risk is acceptable, but probably another prefix like _f would be

>You guys seem to be giving Nathan an extraordinarily hard time about this
>awfully trivial thing (and other trivial things), so much so that it would
Correct, I would be happy to add the _EXPORT to all exported symbols
of the media kit, as I know that it is useful for compiling on other platforms.
But I don't have much time to revise all the code already written.
The same thing is with endianness issues. If you read an int32 from a file,
and you know the file is written in little endian, you should
read it using 
in32 myint = B_LENDIAN_TO_HOST_INT32(the_int_to_be_read);
This  way, your code is correct on both ppc and x86.
All this is in ByteOrder.h, and should be used, for example when 
writing a audio decoder, who reads header data from a WAV file,
this needs to be done, as the data will be in little endian, and to
properly read it on ppc which is big endian, you need to convert it.
The macros do it properly for you.


Other related posts: