Re: [Vala] New params for [ModuleInit]



Hi,
                              في خ، 10-06-2010 عند 20:12 +0200 ، كتب JM:
Inheriting from TypeModule gives me a warning:

main.vala:10.5-10.26: warning: unable to chain up to private base
constructor
    public PluginRegistrar (string name) {

Looks like this isn't possible.
This is just a warning, you can work around it by adding Object(); at
the top of the constructor.

I've tried to make the example work, I don't like it but it's a start
(in particular I don't think making the "registrar" using generics is a
good idea. I don't like the name registrar either.)

Anyway, attached is a working version, I needed to patch gobject
bindings according to what I understood from the documentation.

to compile, I did :

# to compile the interface library
valac -C -H plugin-interface.h --library plugin-interface plugin-interface.vala

# to compile the main program
valac --pkg gmodule-2.0 -C main.vala plugin-interface.vapi
gcc -g -O0 $(pkg-config --cflags --libs gmodule-2.0 gobject-2.0) -I. main.c plugin-interface.c -o main

# to compile the plugin
valac -C plugin.vala plugin-interface.vapi
gcc -g -O0 -shared -fPIC -I. $(pkg-config --cflags --libs glib-2.0) -o libplugin.so plugin.c


The procedure is more complicated than that of the example because the
example was relying on buggy behaviour of valac (not registering types
in other files than the one containing [ModuleInit]).

If someone can polish them and put them in the wiki, it'd be great.

HTH,
Abderrahim

Attachment: gobject.diff
Description: Text Data

Attachment: main.vala
Description: Text Data

Attachment: plugin.vala
Description: Text Data

Attachment: plugin-interface.vala
Description: Text Data



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