22 October 2011

世界初! The trick: gtk2 & gtk3 coexist

GTK+ 2.x and 3.x should be seen as two different libraries.
Of course they are similar, and are source compatible in some level.

Due to the similarity, GTK+ team decided that they can not coexist, and wrote runtime check to make sure that.

There are some tricks and wrappers can do a real "gtk2 & gtk3 coexist", for example you can use a gtk3 web browser and use the gtk2 Adobe flash plugin in it.

Since version 0.5.0, evilvte uses dlopen() to do a "gtk2 & gtk3 coexist".
They do not really coexist in one single window, but you can run one binary to choose gtk2 or gtk3 at runtime like this:

~$ evilvte --2 & evilvte --3 &

Due to the similarity of gtk2 and gtk3, it is quite easy to do the dlopen() trick. I do not think it will be common, but I do hope some others will do the same thing to support two versions of GTK+ at the same time. Maybe not for gtk2 and gtk3, but for gtk3 and gtk4.

I do not think I am the first to do the "choose from 2 libs at runtime", but for gtk2 and gtk3, I think I am really the first in the world. :-P

So I put the Japanese phrase at title, "世界初!", which means "The first in the world!".

No comments:

Post a Comment