Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Tango and Phobos side-by-side?

Moderators: kris

Posted: 06/14/07 17:58:03

Hello,

Is it possible to have the official libgphobos and tango side-by-side? The reason is that developers working with the official GDC will build applications that depend on libgphobos, using the original API. Then some developers may build applications targeting Tango. As far as I understand, the tango library replaces the libgphotos. As a consequence, I think it is not possible to run an application depending on the original phobos, and an application depending on tango. I understand that you wan to replace the original API, I do not know about you, but I think it sucks (yours rules). But why isn't it two separate libraries with an option to select one of them.

I ask this because I would like to build packages for Arch Linux. But I realize that a user could either install an official GDC or a Tango-flavored GDC, but not both!

Regards, Laurent Debacker.

Author Message

Posted: 06/14/07 18:23:57

You seem to have got a couple of points wrong. First, neither of the libraries are currently (at least not commonly) shipped as shared libraries, thus the conflict is only at compile time. This means that if you compile your application with the Phobos based libgphobos, it will still run if you install Tango's libgphobos.

The other misconception here, is that it is our rules. Both DMD and GDC hardcodes the name of the library holding the runtime into the compiler, thus requiring us to replace it. It has been requested many times that this restriction is removed from the compiler.

It is also possible to have both versions installed as long as they are installed in different locations, and don't look for libraries and similar in the same part of the PATH. Maybe an idea to rename one of the binaries.

See PhobosTangoCooperation for some tips on how one may have both installed, and switch easily (note that the instructions are DMD and Windows centric, but the ideas are sane).

Posted: 06/14/07 19:20:55

Thank you very much for your answer. Is it also the case when you build a library? If you compile a dozen libraries statically, you will get a lot of duplicated native code, don't you? In addition you will get two kinds of garbage collectors if not all library build against Tango. I'm sorry to ask such questions, but I could not find more documentation on your website.

Posted: 06/15/07 23:49:23

If you build many static libraries against other static libraries, you will get quite a bit of duplicated code in those libraries, yes. Still, when you build applications with those libraries, you will only get 1 copy of each part of the code. Of course, each application will have it's version of the code, so you can still say there is duplication.

Using GDC on linux, it is also pretty easy to build dynamic libraries, and then you won't have any of the problems related to static libraries and code duplication.

As for the GC and the rest of the runtime, yes, you need to be careful if you are using both Tango and Phobos, as you will get link errors if you try to link in both (you will not be able to link in both such that you get problems runtime). So if you have several libraries that you build against both Tango and Phobos, then you need to make sure that you use the right ones and such.

I am not sure that this is something you need to worry about unless you plan to build a lot of applications that, at least together, use both? If you have something that you need that don't work with Tango, then we will try to help you.

Posted: 08/06/07 05:29:57 -- Modified: 08/06/07 05:32:14 by
turbowwsr

[edit]