On 2016-06-29 12:26, webmind wrote:
On 28/06/16 05:26, Kaare Rasmussen wrote:
In that vein, I'm surprised how easy it is to bind to C libraries. This
could very well be a killer feature for Perl 6 compared to other high
level languages. The resource usage has to come down to a reasonable
level for that to be interesting, though.
Can you perhaps recommend a tutorial or something on how this works?
I don't really know of any tutorial. I just wanted to implement
listen/notify support for PostgreSQL in DBIish
(https://github.com/perl6/DBIish), so I looked at PostgreSQL's excellent
documentation and at the existing native bindings in DBIish.
I think this https://docs.perl6.org/language/nativecall has been updated
since, so perhaps it's a good place to start. Otherwise take a look at
the modules list, there are plenty of modules linking to native
libraries, incl gtk, misc compression and sound libraries, etc.
There's even a module to generate a stub class to start with,
https://github.com/Skarsnik/gptrixie
I think that for more advanced interfaces, these helpers might come in
handy:
https://github.com/jonathanstowe/NativeHelpers-Array
https://github.com/salortiz/NativeHelpers-Blob
But things may have changed or may change in the future, I haven't
looked at it for several months now. Which is equivalent to years in
normal Internet life :-)
/kaare