[PATCH] vala: move GLibMainLoop class into separate file to fix linker errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Vala uses the name of the *.vapi file to determine the libraries to link
against. Since the pa_glib_mainloop_*() functions are in a separate
library (libpulse-mainloop-glib.so) the corresponding objects in the
Vala bindings have to be in a separate *.vapi file.

Otherwise using PA's GLib main loop with Vala fails with linker errors:

	$ cat test.vala
	class Foo : Object {
		PulseAudio.GLibMainLoop loop;
		static void main(){
		}
	}
	$ valac --vapidir=old/vala/ --pkg=libpulse test.vala 
	test.vala:2.2-2.29: warning: field `Foo.loop' never used
		PulseAudio.GLibMainLoop loop;
		^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	/tmp/cc61gzd9.o: In function `foo_finalize':
	test.vala.c:(.text+0x160): undefined reference to `pa_glib_mainloop_free'
	collect2: ld returned 1 exit status
	error: cc exited with status 256
	Compilation failed: 1 error(s), 1 warning(s)
	$ 

A workaround would be:

	$ valac --vapidir=old/vala/ --pkg=libpulse -Xcc -L/usr/lib/libpulse-mainloop-glib.so test.vala 
	test.vala:2.2-2.29: warning: field `Foo.loop' never used
		PulseAudio.GLibMainLoop loop;
		^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	Compilation succeeded - 1 warning(s)
	$ 

The attached patch fixes the issue for me:

	$ valac --vapidir=new/vala/ --pkg=libpulse --pkg=libpulse-mainloop-glib test.vala
	test.vala:2.2-2.29: warning: field `Foo.loop' never used
		PulseAudio.GLibMainLoop loop;
		^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	Compilation succeeded - 1 warning(s)
	$ 

If you don't have any objections, please merge this patch into master.

Best regards

Alexander Kurtz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: move-glib-mainloop-into-separate-vapi.patch
Type: text/x-patch
Size: 2482 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20110325/cf91ca00/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20110325/cf91ca00/attachment.pgp>


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux