Skip to content
Prototype of the native call interface for Rakudo
Perl6 Perl
Find file
Pull request Compare This branch is 3 commits ahead, 206 commits behind jnthn:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
examples
lib
t
.gitignore
META.info
Makefile
README
TODO

README

Zavolaj!

This project prototypes native calling interface functionality for
Rakudo.  It should give Rakudo the ability to call out to C libraries
without having to drop to writing PIR).  The Parrot Native Call
Interface gives a similar facility in PIR.

The project name is the Slovak translation of the imperative "call!", to
complement Blizkost, a Rakudo-to-Perl-5 integration project.

The functions that Zavolaj can currently call must have signatures (the
type of the return value and the types of the arguments) that already
exist in a fixed list inside Parrot.  Adding more signatures currently
involves adding entries to the parrot/src/nci/extra_thunks.nci file.

There is a project to enable calling all possible function signatures:
http://github.com/plobsing/parrot-libjit-fb is currently a Parrot
extension.  Zavolaj does not use it yet.

MySQL

Initially the MySQL client library is being used as a test case, because
it is a popular application, is frequently asked about, and because
Parrot does have all the function signatures.  There is a Rakudo project
http://github.com/mberends/fakedbi that wraps these functions with a DBI
compatible interface.

The /usr/include/mysql.h file defines the mysql client library functions
and their parameters.

Prepare your system along these lines before trying out the examples:

    $ mysql -u root -p
    CREATE DATABASE zavolaj;
    CREATE USER 'testuser'@'localhost' IDENTIFIED BY 'testpass';
    GRANT CREATE      ON zavolaj.* TO 'testuser'@'localhost';
    GRANT DROP        ON zavolaj.* TO 'testuser'@'localhost';
    GRANT INSERT      ON zavolaj.* TO 'testuser'@'localhost';
    GRANT DELETET     ON zavolaj.* TO 'testuser'@'localhost';
    GRANT SELECT      ON zavolaj.* TO 'testuser'@'localhost';
    GRANT LOCK TABLES ON zavolaj.* TO 'testuser'@'localhost';
    GRANT SELECT      ON   mysql.* TO 'testuser'@'localhost';
    # or maybe otherwise
    GRANT ALL PRIVILEGES ON zavolaj.* TO 'testuser'@'localhost';

You can look at the results via a normal mysql connection:

    $ mysql -utestuser -ptestpass
    USE zavolaj;
    SHOW TABLES;
    SELECT * FROM nom;

SQLite3

This library cannot be called yet because of missing Parrot NCI
signatures, see the example file for details.

Microsoft Windows

The win32-api-call.p6 script shows the beginning of a GUI application
written in Perl 6.

Testing

Before running 'make test', you *must* perform this:

    sudo apt-get install libmysqlclient-dev
    sudo apt-get install libtest-harness-perl
    export PERL6LIB=lib


Something went wrong with that request. Please try again.