Call a function in a shared library: Difference between revisions

Content added Content deleted
(→‎{{header|Perl 6}}: update for more strict type constraints)
Line 1,246: Line 1,246:
See [[Call_a_function_in_a_shared_library#Delphi | Delphi]]
See [[Call_a_function_in_a_shared_library#Delphi | Delphi]]
=={{header|Perl 6}}==
=={{header|Perl 6}}==
{{works with|Rakudo|2015.12}}
{{works with|Rakudo|2018.03}}
<lang perl6>use NativeCall;
<lang perl6>use NativeCall;


constant libX11 = '/usr/lib/x86_64-linux-gnu/libX11.so.6';
constant libX11 = '/usr/lib/x86_64-linux-gnu/libX11.so.6';


sub XOpenDisplay(Str $s --> Int) is native(libX11) {*}
sub XOpenDisplay(Str $s --> int32) is native(libX11) {*}
sub XCloseDisplay(Int $i --> Int) is native(libX11) {*}
sub XCloseDisplay(int32 $i --> int32) is native(libX11) {*}


if try my $d = XOpenDisplay ":0.0" {
if try my $d = XOpenDisplay ":0.0" {