[Vala] poppler binding problems
- From: Rumen Zarev <rumen coding gmail com>
- To: vala-list gnome org
- Subject: [Vala] poppler binding problems
- Date: Mon, 16 Aug 2010 02:44:43 -0400
I'm learning vala and was playing with some code using poppler. I found
the following problem.
The type PopplerAction is defined in poppler-glib a union of ActionAny,
ActionUri, and several others. The Vala bindings are:
[Compact]
[CCode (copy_function = "poppler_action_copy", type_id =
"POPPLER_TYPE_ACTION", cheader_filename = "poppler.h")]
public class Action {
public weak Poppler.ActionAny any;
public weak Poppler.ActionGotoDest goto_dest;
public weak Poppler.ActionGotoRemote goto_remote;
public weak Poppler.ActionLaunch launch;
public weak Poppler.ActionMovie movie;
public weak Poppler.ActionNamed named;
public Poppler.ActionType type;
public weak Poppler.ActionUri uri;
public Poppler.Action copy ();
}
[Compact]
[CCode (cheader_filename = "poppler.h")]
public class ActionAny {
public weak string title;
public Poppler.ActionType type;
}
etc.
I have the following code:
Action action = ...
stdout.printf(action.any.title);
This compiles to C code:
fprintf(stdout, action->any->title);
which gives a gcc error.
If I use
stdout.printf((ActionAny) action).title);
this compiles to the correct C code
fprintf(stdout, ((PopplerActionAny *) action)->title);
Since I'm just starting to use vala, I don't know if that's a problem
with the binding, or with the compiler. How does vala deal with unions
in general?
-Rumen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]