zigar_compile(src_path, mod_path = null, params = null) ᴾᴴᴾ - chung-leong/zigar GitHub Wiki

JavaScript | PHP


Compile a Zig module.

If mod_path is omitted, the module path would be derived by combining the directory containg the source file with module_rel_path.

When recompile is set to Off in php.ini, the function returns false immediately.

Use this function to compile a module for multiple platforms.

Usage:

<?php

$targets = [
    [ 'platform' => 'linux', 'arch' => 'x64' ],
    [ 'platform' => 'linux', 'arch' => 'arm64' ],
    [ 'platform' => 'darwin', 'arch' => 'arm64' ],
    [ 'platform' => 'win32', 'arch' => 'x64' ],
];
foreach ($targets as $params) {
    zigar_compile(__DIR__ . '/../zig/hello.zig', $params);
}

Arguments:

  • src_path - Path to the .zig file
  • mod_path - Path to the .zigar directory
  • params - Array containing configuration parameters overriding those set through php.ini

Return value:

boolean


Top-level functions | Configuration