Hi All,
With the help of the guys over on the char line, I wrote my first
inline code. Yippee!!
I did not realize the name of the was was also the name
of the line line c call. And I did not realize the
call really did want an initialized variable as its
parameter.
<code>
#!/usr/bin/perl6
#`{
reference: man XDisplayName
char *XDisplayName(char *string);
sub display-name(Str:D $name) is native('X11') is
symbol("XDisplayName") { * }
reference:
https://tronche.com/gui/x/xlib/event-handling/protocol-errors/XDisplayName.html
The XDisplayName() function returns the name of the display
that XOpenDisplay()
would attempt to use. If a NULL string is specified,
XDisplayName() looks in the
environment for the display and returns the display name that
XOpenDisplay() would
attempt to use. This makes it easier to report to the user
precisely which display
the program attempted to open when the initial connection
attempt failed.
}
use NativeCall;
sub XDisplayName(Str:D $name) is native('X11') returns Str { * };
my $Display;
my $NullStr; # Do not initialize this guy!
$Display = XDisplayName( $NullStr );
print "\$Display = <$Display>\n";
</code>
$ ./X11Display.pl6
$Display = <:0.0>
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Computers are like air conditioners.
They malfunction when you open windows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~