[Vala] Mixing C with vala
- From: Daniel Brendle <grindhold skarphed org>
- To: vala-list <vala-list gnome org>
- Subject: [Vala] Mixing C with vala
- Date: Wed, 23 Sep 2015 22:16:06 +0200
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Hi guys.
I want to use Vala together with C, in order to do some lowlevel
manual memory management stuff in a certain subsystem of my program.
At first i tried writing g-object boilerplate-code myself, but it was
a bit cumbersome, so i decided to write a class in vala and let the
vala compiler generate the boilerplate-code for me. (I obtained the c
file via -C and the headerfile via -h)
currently i have 4 files involved:
main.vala
nsp-page.c
nsp-page.h
nsp.vapi
main.vala has a simple main-method and creates a Nsp.Page. nsp-page.c
and nsp-page.h contain the gobject-code for the Nsp.Page class.
nsp.vapi describes the Nsp.Page-class towards the vala compiler.
I try to compile everything with
$ valac -X -I. --vapidir . --pkg nsp main.vala nsp-page.c
Now the following problem arises:
main.vala.c:(.text+0x8b): undefined reference to `nsp_page_unref'
Of course, the C-code generated from main.vala tries to unreference
the generated Page-object. This method does not exist anywhere. When i
write Nsp.Page as regular vala-class, main.c tries to derefence the
Page-object via g_object_unref() instead of some class-specific method
that doesn't exist.
What am I doing wrong here?
Yours, Grindhold
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBCAAGBQJWAwiGAAoJEBuqgJs6izSEcOoP/icL8h1qRMBK+SzaSZ6h/J8b
LXCnhycS27Sf94M+fM80iCPrWKY4KytWRgAJeYCpsCNA3dLYumfpMTXBAHeCGvuK
btv3dbk4XigaO0KC4vbY6WU/oKh5LQ6yM4+5koQAgQ5BIDt3T1pSmfciTNR8PPa3
SNgdqkiGYAVGb7yfV4eCj66FTWo+jBoF1n8MFYh3ALrh2gTG3sg2svmaNQBR4Dzw
wg/AS/HOaqhfJ11FhK80QV4G1AtdzH9MHfekimAdhGkfTs70qz8IuCjLjQp3SVzp
VJdx2eHwKECAhJ3otOybogtzBZVbra5zm5E0vc+VgayQNIl4etpiAai4BBGaiCYt
VvIKUcGZwhJuL8G0wJPEnH4SPlLkQ8sdUPPo5MfbAElj0dgzMvfNaD4x5DlaCCrK
GE48DN4mmvncFdav+h7m9Q32hFKX9P9pm0HENxiAA8w/Tb8SWBaXcp+xBaajfZu7
CZ7DMErmlYJg3gDEah9jXqzhYlLV3hGww4A++106fLE8CfWphponjSUozGhVS9Zb
a8tuxneW/72NSSRBVNK6rSnGNW0thDejh5pMcB/MPP9laoR+QtNJI+2iPKAZJSbb
gICTea0nWK3J4pwXK9sxD2rSX/9knOIt2oCVeTchHHCtoIvKLDivg6fC2keq8FnH
cOVgzbeiRj3i2OklTYsG
=Rhae
-----END PGP SIGNATURE-----
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]