Attached files are an example I have done, I use the vala-gen-introspect method :
https://live.gnome.org/Vala/Bindings/GI

Then I modifed the generated file, I had to tweak the "cname" and "cprefix" values
in order that it works.

Well I'm not an expert I don't know if it's really correct, but it works fine, it seems
that you have the same troubles.

Regards.

On 10/01/2012 23:52, Denis Kuzmenok wrote:
Hi.
I  need  some  help  with  vapi  file.  I'm making vapi for C non-Glib
library. There are structs, i write them into vapi, as
  namespace AC ->  struct AC_Automata

And i'm getting errors:
undefined reference to `ac_ac_automata_destroy'

But  there  is no destroy calls in .c files (except one free call from
the  function),  so  i  suppose it's some vapi magic that inserts that
calls.
Is  there any docs describing possible variables for CCode? There is a
link to image on live.gnome.org, but it's broken..

Thanks.

_______________________________________________
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list



--
Axel FILMORE

/* libmenu-cache.vapi generated by vapigen, do not modify. */

namespace Mc {
	[CCode (cname = "MenuCache", cprefix="menu_cache_", cheader_filename = "menu-cache.h", ref_function = "menu_cache_ref", unref_function = "menu_cache_unref")]
	[Compact]
	public class Cache {
		public void* add_reload_notify (GLib.Func func);
		public uint32 get_desktop_env_flag (string desktop_env);
		public unowned CacheDir get_dir_from_path (string path);
		public unowned CacheDir get_root_dir ();
		public static void init (int flags);
		public unowned GLib.SList list_all_apps ();
		public static unowned Cache lookup (string menu_name);
		public static unowned Cache lookup_sync (string menu_name);
		public bool reload ();
		public void remove_reload_notify (void* notify_id);
	}
	[CCode (cname = "MenuCacheApp", cprefix="menu_cache_app_", cheader_filename = "menu-cache.h")]
	[Compact]
	public class CacheApp {
		public unowned string get_exec ();
		public bool get_is_visible (uint32 de_flags);
		public uint32 get_show_flags ();
		public bool get_use_sn ();
		public bool get_use_terminal ();
		public unowned string get_working_dir ();
	}
	[CCode (cname = "MenuCacheDir", cprefix="menu_cache_dir_", cheader_filename = "menu-cache.h")]
	[Compact]
	public class CacheDir {
		public unowned GLib.SList get_children ();
		public unowned string make_path ();
	}
	[CCode (cname = "MenuCacheItem", cprefix="menu_cache_item_", cheader_filename = "menu-cache.h", ref_function = "menu_cache_item_ref", unref_function = "menu_cache_item_unref")]
	[Compact]
	public class CacheItem {
		public unowned Type get_type ();
		public unowned string get_comment ();
		public unowned string get_file_basename ();
		public unowned string get_file_dirname ();
		public unowned string get_file_path ();
		public unowned string get_icon ();
		public unowned string get_id ();
		public unowned string get_name ();
		public unowned CacheDir get_parent ();
	}
	[CCode (cname="MenuCacheItemFlag", cheader_filename = "menu-cache.h", cprefix = "FLAG_", has_type_id = false)]
	public enum Item {
		USE_TERMINAL,
		USE_SN
	}
	[CCode (cname="MenuCacheShowFlag", cheader_filename = "menu-cache.h", cprefix = "SHOW_", has_type_id = false)]
	public enum Show {
		IN_LXDE,
		IN_GNOME,
		IN_KDE,
		IN_XFCE,
		IN_ROX,
		N_KNOWN_DESKTOPS
	}
	[CCode (cname="MenuCacheType", cheader_filename = "menu-cache.h", cprefix = "MENU_CACHE_TYPE_", has_type_id = false)]
	public enum Type {
		NONE,
		DIR,
		APP,
		SEP
	}
}
/* libmenu-cache.vapi generated by vapigen, do not modify. */

namespace Menu {
        [CCode (cheader_filename = "libmenu-cache.h", ref_function = 
"menu_cache_ref", unref_function = "menu_cache_unref")]
        [Compact]
        public class Cache {
                public void* add_reload_notify (GLib.Func func);
                public uint32 get_desktop_env_flag (string desktop_env);
                public unowned Menu.CacheDir get_dir_from_path (string path);
                public unowned Menu.CacheDir get_root_dir ();
                public static void init (int flags);
                public unowned GLib.SList list_all_apps ();
                public static unowned Menu.Cache lookup (string menu_name);
                public static unowned Menu.Cache lookup_sync (string menu_name);
                public bool reload ();
                public void remove_reload_notify (void* notify_id);
        }
        [CCode (cheader_filename = "libmenu-cache.h")]
        [Compact]
        public class CacheApp {
                public unowned string get_exec ();
                public bool get_is_visible (uint32 de_flags);
                public uint32 get_show_flags ();
                public bool get_use_sn ();
                public bool get_use_terminal ();
                public unowned string get_working_dir ();
        }
        [CCode (cheader_filename = "libmenu-cache.h")]
        [Compact]
        public class CacheDir {
                public unowned GLib.SList get_children ();
                public unowned string make_path ();
        }
        [CCode (cheader_filename = "libmenu-cache.h", ref_function = 
"menu_cache_item_ref", unref_function = "menu_cache_item_unref")]
        [Compact]
        public class CacheItem {
                public unowned string get_comment ();
                public unowned string get_file_basename ();
                public unowned string get_file_dirname ();
                public unowned string get_file_path ();
                public unowned string get_icon ();
                public unowned string get_id ();
                public unowned string get_name ();
                public unowned Menu.CacheDir get_parent ();
        }
        [CCode (cheader_filename = "libmenu-cache.h", cprefix = "FLAG_USE_", 
has_type_id = false)]
        public enum CacheItemFlag {
                TERMINAL,
                SN
        }
        [CCode (cheader_filename = "libmenu-cache.h", cprefix = "", has_type_id 
= false)]
        public enum CacheShowFlag {
                SHOW_IN_LXDE,
                SHOW_IN_GNOME,
                SHOW_IN_KDE,
                SHOW_IN_XFCE,
                SHOW_IN_ROX,
                N_KNOWN_DESKTOPS
        }
        [CCode (cheader_filename = "libmenu-cache.h", cprefix = 
"MENU_CACHE_TYPE_", has_type_id = false)]
        public enum CacheType {
                NONE,
                DIR,
                APP,
                SEP
        }
}
#!/bin/sh


ls /usr/lib/pkgconfig/ |grep menu-cache
grep Cflags /usr/lib/pkgconfig/libmenu-cache.pc
ls /usr/lib/libmenu-cache*.so
grep 'typedef struct' /usr/include/menu-cache/menu-cache.h
echo
echo
echo "include/menu-cache/" > libmenu-cache.files
echo "lib/libmenu-cache.so" >> libmenu-cache.files
echo "Menu" > libmenu-cache.namespace
vala-gen-introspect libmenu-cache .
vapigen --library libmenu-cache libmenu-cache.gi

_______________________________________________
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to