GNOME Bugzilla – Bug 656893
Include-the-name-of-the-created-file-in-the-gir
Last modified: 2011-08-21 17:38:53 UTC
Created attachment 194214 [details] [review] The proposed patch to pass the name of the output to the girwriter. Sometimes it is helpful if the name of a shared-object corresponding to a gir file is named in the namespace tag of the gir file using the shared-library-attribute. With this patch it is a straight forward way to created introspectable libraries in two lines: # valac --pkg gio-2.0 --library=Atest --gir=Atest-0.1.gir -o libAtest.so --Xcc="-shared" --Xcc="-fPIC" A.vala # g-ir-compiler Atest-0.1.gir > Atest-0.1.typelib # ls Atest-0.1.gir Atest-0.1.typelib Atest.vapi A.vala
We need another option switch for passing the libfoo.so to gir because: 1) it might happen to have multiple .so 2) you can generate a gir but the .so using gcc directly, not necessarily with -o and -X -shared Something like --gir-library or such.
(In reply to comment #1) > We need another option switch for passing the libfoo.so to gir because: > 1) it might happen to have multiple .so But you can't have multiple .so files with stock valac, or can you? What about adding a real "create library" functionality to the ccompiler, so valac is able to build shared objects. Would this make sense? > 2) you can generate a gir but the .so using gcc directly, not necessarily with > -o and -X -shared > > Something like --gir-library or such. I'd suggest --gir-shared-library to match the corresponding tag.
Looking at the source of gobject-introspection [1], it seems that we need to pass the libraries, otherwise shared libraries won't be found. -- 1: http://git.gnome.org/browse/gobject-introspection/tree/girepository/gitypelib.c#n2142
On IRC was pointed out, that the shared-library can also be passed to gircompiler, so closing this. *** This bug has been marked as a duplicate of bug 642576 ***