Re: [Vala] New params for [ModuleInit]



Hello Abderrahim
Thanks for the help! 
Your example compiles and can be executed. However there is a warning on
execution:
$ ./main 
Loading plugin with path: '/home/me/plugin-example-new/libplugin.so'
Loaded module: '/home/me/plugin-example-new/libplugin.so'
Plugin type: MyPlugin

Loading plugin with path: '/home/me/plugin-example-new/libplugin.so'
Hello world!

(process:3609): GLib-GObject-WARNING
**: /build/buildd/glib2.0-2.24.1/gobject/gtypemodule.c:112:
unsolicitated invocation of g_object_dispose() on GTypeModule
Should be unloading plugin with path
'/home/me/plugin-example-new/libplugin.so'

I guess that's happening when unreffing the Registrar.

You mentioned a bug with [ModuleInit]. Is this the same thing as the bug
I filed here:
https://bugzilla.gnome.org/show_bug.cgi?id=621317
?
Regards
Jörn

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





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