KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I created 4 files to wrap a c++ class in php Extension.Now I want to run the code for wrapping.But I have no idea about that.How can I run the code? I'm following the tutorial over at http://devzone.zend.com/article/4486 , and here's the Graph code I have so far: vehicles.cc #include "php_vehicles.h" #include "car.h" zend_object_handlers car_object_handlers; struct car_object { zend_object std; Car *car; }; zend_class_entry *car_ce; void car_free_storage(void *object TSRMLS_DC) { car_object *obj = (car_object *)object; delete obj->car; zend_hash_destroy(obj->std.properties); FREE_HASHTABLE(obj->std.properties); efree(obj); } zend_object_value car_create_handler(zend_class_entry *type TSRMLS_DC) { zval *tmp; zend_object_value retval; car_object *obj = (car_object *)emalloc(sizeof(car_object)); memset(obj, 0, sizeof(car_object)); obj->std.ce = type; ALLOC_HASHTABLE(obj->std.properties); zend_hash_init(obj->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0); zend_hash_copy(obj->std.properties, &type->default_properties, (copy_ctor_func_t)zval_add_ref, (void *)&tmp, sizeof(zval *)); retval.handle = zend_objects_store_put(obj, NULL, car_free_storage, NULL TSRMLS_CC); retval.handlers = &car_object_handlers; return retval; } PHP_METHOD(Car, __construct) { long maxGear; Car *car = NULL; zval *object = getThis(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &maxGear) == FAILURE) { RETURN_NULL(); } car = new Car(maxGear); car_object *obj = (car_object *)zend_object_store_get_object(object TSRMLS_CC); obj->car = car; } PHP_METHOD(Car, shift) { } PHP_METHOD(Car, accelerate) { Car *car; car_object *obj = (car_object *)zend_object_store_get_object( getThis() TSRMLS_CC); c
Tags (comma-separated)
Save Edits
Cancel