Hmm. That was too early. 
I replied after compiling was fine, but the TypeModule Example is
crashing on execution.

./main 
Loading plugin with path: '/home/me/plugin-example/libplugin.so'
Loaded module: '/home/me/plugin-example/libplugin.so'

** (process:27029): CRITICAL **: register_plugin: assertion `module !=
NULL' failed
Plugin type: (null)


(process:27029): GLib-GObject-CRITICAL **: g_object_new: assertion
`G_TYPE_IS_OBJECT (object_type)' failed

(process:27029): GLib-GObject-CRITICAL **: g_object_is_floating:
assertion `G_IS_OBJECT (object)' failed
Segmentation fault


...
The example does not give a TypeModule arg and creating a TypeModule
with 'TypeModule tm = new TypeModule();' doesn't work.

Will it be necessary to have one TypeModule per application and do
register_* for all plugin types with it or will it be one per plugin? 
Or am I getting this totally wrong?

Maybe it will be easier to understand if someone can fix the example on
the vala website.
Regards
Jörn


> Hello Abderrahim
> Thanks for reply! 
> I somehow got the error message in a wrong way, because I thought the 
> "[ModuleInit]" annotation itself needed some extra info.
> Now it's working fine again. 
> Sorry for the hassle.
> Regards
> Jörn
> 
> 
> 
> > Hi,
> > 
> > 2010/6/10, JM <interfl...@gmx.net>:
> > > Hello everybody
> > >  This valac commit shows that there has been some change with
> > >  [ModuleInit]:
> > >  
> > > http://git.gnome.org/browse/vala/commit/?id=5fd7b8cebb983fccdebcd9329671d94c1e5cf826
> > >
> > >  The example on http://live.gnome.org/Vala/TypeModules is showing an
> > >  example exactly as I am using it in my application:
> > >
> > >  [ModuleInit]
> > >  public Type register_plugin (TypeModule module) {
> > >     // types are registered automatically
> > >     return typeof (MyPlugin);
> > >  }
> > >
> > >  Here, valac reports "error: [ModuleInit] requires a parameter of type 
> > > `GLib.TypeModule'
> > >  public Type init_module() {"
> > 
> > I'm not sure I understand your problem, in the example register_plugin
> > takes a TypeModule as parameter but from what I see in the error
> > message, your init_module doesn't take any parameter, and that's what
> > valac is saying.
> > 
> > >
> > >  Can someone please tell me what the expected usage of
> > >  [ModuleInit] would be?
> > 
> > a [ModuleInit] function is called by the application when a plugin is
> > loaded. It should have at least a TypeModule argument so that the
> > plugin types can be registered dinamically. (It generally returns the
> > type of the main plugin class for the application to create an
> > instance, but that's not mandatory : the application can find it out
> > from e.g. the plugin description file if there is one).
> > 
> > HTH,
> > Abderrahim
> 
> 
> _______________________________________________
> vala-list mailing list
> vala-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/vala-list



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

Reply via email to