![]() |
![]() |
![]() |
liboscats Reference Manual | ![]() |
---|
The php_gtk2
extension must be
loaded before the php_oscats
extension in order to resolve
dynamic linking dependencies. This may be done in
php.ini
or dynamically with something like:
if (!class_exists('gtk')) dl('php_gtk2.so'); if (!class_exists('Oscats')) dl('php_oscats.so');
PHP class names are identical to C class names. PHP method names have
been stripped of the package and class name. So,
g_gsl_vector_get(obj, i)
becomes $obj->get($i)
and
oscats_test_administer(tst, ex)
becomes $tst->administer($ex)
. Functions that are not object
methods have been stripped of the oscats_ prefix,
for example Oscats::rnd_normal(1)
.
Objects with an explicit construction method,
oscats_*_new(...)
, or that do not require constuction
properties can be created with the usual PHP symantics. For example,
$v = new GGslVector(10); $model = new OscatsContModelL1p();
For objects that require construction properties, the object name must be specified in the first argument as a string and the properties as an array of key-value pairs in the second argument (this is a bit cumbersome, but is how the PHP Gtk bindings were written). For example,
$tst = new OscatsTest('OscatsTest', array("id" => $name, "itembank" => $bank));
Since PHP has automatic garbage collection, it isn't necessary to free objects explicitly.