I am doing some experiments with Phalcon Zephir to see how well it can convert some of my libraries to PHP extensions.
I have two PHP classes, each of which is already defined in its own file: Zephir notes are very clear that this should be so.
trienode.zep
namespace tries;
class trienode
{
public children;
public valueNode = false;
public value = null;
public function __construct()
{
let this->children = [];
}
}
and
trie.zep
namespace tries;
class trie {
private trie;
public function __construct() {
let this->trie = new trienode();
}
}
But whenever I try to compile classes with zephir compile, I get
Warning: Class "trienode" does not exist at compile time in /home/vagrant/ext/tries/tries/trie.zep on 8 [nonexistent-class]
let this->trie = new trienode();
---------------------------------------^
(and if I continue the build process and install the resulting .so file, these are errors when I try to use it from a PHP script)
<?php
namespace tries;
$test = new trie;
gives
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/tries.so' - /usr/lib/php5/20121212/tries.so: undefined symbol: zephir_tries_trie_init in Unknown on line 0
PHP Fatal error: Class 'tries\trie' not found in /home/vagrant/triesTest.php on line 5
I looked at Zephir documentation and various blog entries, but cannot find examples of creating an extension containing more than one class file.
- Zephir, ? , ( ) ?