Re: [Vala] Binding questions



On Sun, 15 Feb 2009 23:05:03 -0500
"Michael B. Trausch" <mike trausch us>
wrote:

... creating "&_tmp0" of type gint on its own.  What happens if there
is no such parameter (say, the list is returned and you get the count
by doing pointer arithmetic until you reach a sentinel value of some
sort), or it is in a different location (say, the first or second
parameter in the list)?

I actually have an example of this that I ran into today... for
libuuid.  It seems to inject too many parameters.  When I declare:

  [CCode(lower_case_cprefix="uuid_")]
  public static void generate(out char[16] new_uuid);

I call this in Vala like so:

  char[16] uuid;
  LibUUID.generate(out uuid);

When called, Vala writes:

  gint uuid_length1;
  gchar *uuid;
  uuid_generate(&uuid, &uuid_length1);

I would expect that it would generate:

  gchar uuid[16];
  uuid_generate(&uuid);

Or maybe even:

  gchar *uuid;
  uuid = g_malloc0(16);
  uuid_generate(&uuid);

Either way, it understands that the function takes a reference to a
16-byte buffer, and I am telling it (I think) that this is an invariant
number.  Am I doing something wrong, or is this a bug?

        --- Mike

-- 
My sigfile ran away and is on hiatus.
http://www.trausch.us/





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