Re: G::O::I based bindings and problem passing char array ref



The @data argument should be marked as an array, with length stored in
the @length argument, i.e.:

 @data: (array length=length): the pdf data contained in a char array

This will allow the introspection bindings to know that you're passing
an array with a specified length, instead of just a pointer.

Hmmm... I made the first change as you indicate and generated a new
typelib properly (I believe), but the problem persists. I now get more
informative errors if I try to give it anything but a reference to a byte
array ("need an array ref to convert to GArray"), which is helpful, but I still get the "PDF document is 
damaged" error when I produce the
input parameter from the data string as:

    $data = [unpack "C*", $data];

If it helps, my updated typelib file was pushed to a dev branch at:

https://github.com/c9s/perl-poppler/tree/new_from_data

I'm in unfamiliar territory here so maybe I'm missing something fundamental in
terms of what the C lib is expecting. Again, the previous XS version (which
works) doesn't look like it's doing anything fancy. Also seems strange to me
that the parameter definition in the *.gir file now looks almost identical to
that for the librsvg new_from_data() constructor, but the above transformation
works as input for that library but not for this one.

Thanks for the help so far. Gobject introspection rocks.

Jeremy




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