I am getting the following error:
$ php -d enable_dl=On test.php
PHP Fatal error: Cannot instantiate abstract class base in demo.php on line 100
swig generates:
static function create_concrete($b=true) {
$r=base_create_concrete($b);
if (!is_resource($r)) return $r;
switch (get_resource_type($r)) {
case '_p_base': return new base($r);
default: return new base($r);
}
}
for the following input C++:
struct base
{
virtual void foo() = 0;
static base * create_concrete(bool b = true);
};
Full example is at:
https://github.com/malaterre/PublicRep/tree/master/SWIG/virtualbase
This is fixed in git master, presumably by the rewrite to use PHP's C API to create classes instead of generating a
.phpscript which defines them.The test needs adjusting to remove
require_once( 'demo.php' );(as that file no longer gets generated at all) and then the output is now:(PHP resources are no longer used by SWIG in the generated wrapper code, so the
is_resource()checks in your test code will all be false now.)This work will be in PHP 4.1.0.