On Wed, May 25, 2016 at 2:41 PM, Fernando Santagata < nando.santag...@gmail.com> wrote:
> > gboolean notify_get_server_info (char **ret_name, > char **ret_vendor, > char **ret_version, > char **ret_spec_version); > > I think that the four arguments return the information about the system. > The problem here is that I'm not an expert on NativeCall, which I'm just > beginning to love, and I don't know how to map those char **. > > What I concocted on the Perl6 side so far is this: > > sub notify_get_server_info(Str $name is rw, Str $vendor is rw, Str > $version is rw, Str $spec_version is rw) returns Bool is native('notify', > v4) is export {}; > > The calling program goes like this: > > my Str ($name, $vendor, $version, $spec_version); > if notify_get_server_info($name, $vendor, $version, $spec_version) { > say $name, $vendor, $version, $spec_version; > }else{ > say 'No server info'; > } > > and it prints > > (Str)(Str)(Str)(Str) > > So, I get that the mapping is wrong. > In this case, you need to pass a Pointer[Str] which will be filled in by the C function. Just using a Str directly passes a (char *), not a (char **), and you ended up with a pointer where rakudo expected characters. -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net