🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Runtime linking shared objects

Started by
16 comments, last by Lord_Evil 15 years, 8 months ago
Quote: Original post by Yann L
Oh, and if you are porting a C++ engine from Windows to Linux and intend to support C++ plugins, then you might also want to look into fvisibility. This feature is extremely important. Again, it's something that's not widely publicized in the Linux community (due to, again, resistance from some fanatics), but developing/porting a good plugin system without it is next to impossible. I almost went insane back when I tried it, until I finally found this feature...
I still wonder why this isn't catching on faster outside of OS X? Various versions of XCode have marked all symbols private by default, so it was pretty much a forced adoption there - but it is a very useful feature across the board.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Advertisement
Quote: Original post by swiftcoder
I still wonder why this isn't catching on faster outside of OS X?

I think that like most things in Linux, it's more about ideology than about technology. If you consider that many Linux programmers still consider C as the epitome of perfection, it's no wonder that adoption of such features is stagnant. Also, the fact that these features originated from proprietary Microsoft language extensions (and the cognitive dissonance it induced in some FSF people) is probably another important factor.

But well, fortunately Niall Douglas managed to push his (immensely useful) patch through to the gcc trunk.
Quote: Original post by Yann L
Quote: Original post by swiftcoder
I still wonder why this isn't catching on faster outside of OS X?

I think that like most things in Linux, it's more about ideology than about technology.

What a warm and steaming moist pile of crap.

The reason -rpath is not used much is purely historical.

(1) Fast internet connections are not only recent, but still not widespread downloading a gigabyte of libraries for each application is a nonstarter.
(2) Huge disks are relatively recent and still not widespread. I used to administer a Unix system with 150 MB shared between 30 developers. You're promoting a single application taking upwards of 300 MB.
(3) Many different linkers has an "rpath" argument, but it works completely differently on different platforms (consider how the -rpath argument wored on Digital/Tru64 Unix, and again on HP-UX 10. or how it blows up on AIX pre-4.0) so it was never made the default for source builds. Because it's not the default, few developers used it. Few developers ever go beyond the default settings, even on Microsoft Windows.

About the visibility modifier in GCC: it's new. So new that most developers don't have access to a compiler that supports it. It's true that if you have a huge hard drive and a high speed internet connection you could download the source and build one or else download a new distro and install one, but most professionals have better things to do with their time (although some of us are paid to do just that on a regular basis, but we're the exception).

I would also like to point out that you will find no greater an evangelist for using the visibility modifier than Ulrich Drepper of Red Hat, maintainer of the GNU C runtime. The visibility modifier is primarily for the C language.
Quote: If you consider that many Linux programmers still consider C as the epitome of perfection, it's no wonder that adoption of such features is stagnant.

There's a value judgment based in prejudice.
Quote: Also, the fact that these features originated from proprietary Microsoft language extensions (and the cognitive dissonance it induced in some FSF people) is probably another important factor.

Your argument would be stronger if it was not based on incorrect premises. I used similar directives programming in FORTRAN IV on a PDP-11 running RSX before Bill Gates even dropped out of college. There is no political objection to symbol visibility coming from the FSF -- if there were, the strip command would have been neutered long ago. The symbol versioning in ELF binaries would have been boycotted (and Microsoft's linker does not even have the equivalent).

I would like to point out that a paper was even presented at the last C++ standard committee meeting proposing that such directives be made adopted into the next revision of the C++ language (in what, 10 years or so).

Stephen M. Webb
Professional Free Software Developer

Quote: Original post by Bregma
Quote: Original post by Yann L
Quote: Original post by swiftcoder
I still wonder why this isn't catching on faster outside of OS X?

I think that like most things in Linux, it's more about ideology than about technology.

What a warm and steaming moist pile of crap. The reason -rpath is not used much is purely historical.
I was referring to -fvisibility, not rpath.

Quote: About the visibility modifier in GCC: it's new. So new that most developers don't have access to a compiler that supports it.
GCC 4.0 is so hard to find? Most of the major linux distros seem to have adopted GCC 4, as well as OS X - there are even a few MinGW binaries floating around as well.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Quote: Original post by swiftcoder
Quote: Original post by Bregma
About the visibility modifier in GCC: it's new. So new that most developers don't have access to a compiler that supports it.
GCC 4.0 is so hard to find? Most of the major linux distros seem to have adopted GCC 4, as well as OS X - there are even a few MinGW binaries floating around as well.

It was broken until 4.3. That's the latest-and-greatest version of GCC. Consider Debian Etch and RHEL4 (which account for a big chunk of professional Linux installations) use 4.1. If you want to distribute software, you want to target the LSB and that means using GCC 3.4.

Another lesson that Microsoft learned was that if you distribute a binary with visible symbols, people will use the "undocumented API" and you're stuck supporting cruft until you're brave enough to break ABI. That means anyone who shipped libraries or a plugin interface prior to GCC 4.3 can't use the visibility specifiers without risking alienating their existing userbase. I speak from experience here.

Either way, the lack of use of the visibility specifiers in free software is not beacuse a bunch of foaming-at-the-mouth pigheaded free software zealots have raged against it because someone at Microsoft implemented an existing and widely-used idea. It's because it's a new feature that has technical barriers to widespread dissemination.

I will also point out that the foaming-at-the-mouth free software zealots are among the most prominent evangelists of its use.

Stephen M. Webb
Professional Free Software Developer

Quote: Original post by Bregma
What a warm and steaming moist pile of crap.

The reason -rpath is not used much is purely historical.

We were talking about fvisivility, but well, my arguments also hold for rpath. Even more so, actually.

Quote: Original post by Bregma
(1) Fast internet connections are not only recent, but still not widespread downloading a gigabyte of libraries for each application is a nonstarter.

What are you talking about ? A gigabyte of libraries ?! Show me one professional application or game that ships with a gigabyte of executable code. Just one. You might not be aware of it, but 'rpath-alike' distribution is entirely common in the Windows world. And, *gasp*, it works there !

Quote: Original post by Bregma
(2) Huge disks are relatively recent and still not widespread. I used to administer a Unix system with 150 MB shared between 30 developers. You're promoting a single application taking upwards of 300 MB.

I'm sorry, but you are not my target base. And probably not the target base of 99.9% of all modern application or game developers. Especially not in times where a terrabyte harddisk costs almost less than the gas to fill up my car twice.

Quote: Original post by Bregma
(3) Many different linkers has an "rpath" argument, but it works completely differently on different platforms (consider how the -rpath argument wored on Digital/Tru64 Unix, and again on HP-UX 10. or how it blows up on AIX pre-4.0) so it was never made the default for source builds.

Watch me how much I care about a version of AIX that was released in 1992 or about a '95 vintage HPUX... Oh, right, not at all. In fact, I couldn't care less about anything that is not x86 or x64 compatible. We're a game developer board, remember ?

Quote: Original post by Bregma
Few developers ever go beyond the default settings, even on Microsoft Windows.

Well, incompetence isn't OS dependent.

Quote: Original post by Bregma
About the visibility modifier in GCC: it's new. So new that most developers don't have access to a compiler that supports it. It's true that if you have a huge hard drive and a high speed internet connection you could download the source and build one or else download a new distro and install one, but most professionals have better things to do with their time (although some of us are paid to do just that on a regular basis, but we're the exception).

Oh cry me a river. You're a professional developer, but can't be bothered to download an up-to-date compiler ? And internet connection speed ? You mean that internet that 10 year olds use to download gigabytes of warez, pirated DVDs and porn movies ? And you're telling me a professional programmer is unable to get hold of the latest version of a free compiler ?

Quote: Original post by Bregma
Quote: If you consider that many Linux programmers still consider C as the epitome of perfection, it's no wonder that adoption of such features is stagnant.

There's a value judgment based in prejudice.

Oh, you mean prejudice like that one ?

Quote:
If you want to distribute software, you want to target the LSB and that means using GCC 3.4.

No it doesn't. Not everyone wants to ship source, you know ?

Anyway, I think I had enough fighting with FOSS zealots lately. It's a bit tiring to be honest, since it's always about the same old recycled arguments. So, Lord_Evil, if you have any further problems with rpath or fvisibility, just PM me.
Oh, just to add this:

Quote: Original post by Bregma
It was broken until 4.3.

Wrong. It works fine on 4.2.1, for example. And that's the gcc version shipped with OpenSuse 10.3, which isn't that fresh anymore (current one is 11.1).
Quote: Original post by Yann L
So, Lord_Evil, if you have any further problems with rpath or fvisibility, just PM me.

Thanks :)

If I was helpful, feel free to rate me up ;)If I wasn't and you feel to rate me down, please let me know why!

This topic is closed to new replies.

Advertisement