extern (C) { /* structs required */ struct zend_module_entry { ushort size; uint zend_api; ubyte zend_debug; ubyte zts; zend_ini_entry *ini_entry; zend_module_dep *deps; char *name; zend_function_entry *functions; void function(int type, int module_number) module_startup_func; // int (*module_startup_func)(INIT_FUNC_ARGS); void *module_shutdown_func; // int (*module_shutdown_func)(SHUTDOWN_FUNC_ARGS); void *request_startup_func; // int (*request_startup_func)(INIT_FUNC_ARGS); void *request_shutdown_func; // int (*request_shutdown_func)(SHUTDOWN_FUNC_ARGS); void *info_func; //void (*info_func)(ZEND_MODULE_INFO_FUNC_ARGS); char *version_name; // name changed due to conflict.. void *post_deactivate_func; /* int (*post_deactivate_func)(void); */ int globals_id; int module_started; ubyte type; void *handle; int module_number; }; struct zend_module_dep { char *name; /* module name */ char *rel; /* version relationship: NULL (exists), lt|le|eq|ge|gt (to given version) */ char *version_name; /* version - name changed..*/ ubyte type; /* dependency type */ }; struct zend_function_entry { char *fname; void * handler; //void (*handler)(INTERNAL_FUNCTION_PARAMETERS); zend_arg_info *arg_info; zend_uint num_args; zend_uint flags; }; struct zend_ini_entry { int module_number; int modifiable; char *name; uint name_length; void *on_modify; /* ZEND_INI_MH((*on_modify)); ((void *) at present.. */ void *mh_arg1; void *mh_arg2; void *mh_arg3; char *value; uint value_length; char *orig_value; uint orig_value_length; int modified; void *displayer; /* (*displayer)(zend_ini_entry *ini_entry, int type); (void *) */ }; struct zend_object_value { zend_object_handle handle; zend_object_handlers *handlers; }; struct zend_object_handlers { /* general object functions */ void *add_ref; // zend_object_add_ref_t void *del_ref; // zend_object_del_ref_t void *clone_obj; // zend_object_clone_obj_t /* individual object functions */ void *read_property; // zend_object_read_property_t void *write_property; // zend_object_write_property_t void *read_dimension; // zend_object_read_dimension_t void *write_dimension; // zend_object_write_dimension_t void *get_property_ptr_ptr; // zend_object_get_property_ptr_ptr_t void *get; // zend_object_get_t void *set; // zend_object_set_t void *has_property; // zend_object_has_property_t void *unset_property; // zend_object_unset_property_t void *has_dimension; // zend_object_has_dimension_t void *unset_dimension; // zend_object_unset_dimension_t void *get_properties; // zend_object_get_properties_t void *get_method; // zend_object_get_method_t void *call_method; // zend_object_call_method_t void *get_constructor; // zend_object_get_constructor_t void *get_class_entry; // zend_object_get_class_entry_t void *get_class_name; // zend_object_get_class_name_t void *compare_objects; // zend_object_compare_t void *cast_object; // zend_object_cast_t void *count_elements; // zend_object_count_elements_t }; alias ubyte zend_bool; alias uint zend_uint; alias uint zend_object_handle; struct zend_arg_info { char *name; zend_uint name_len; char *class_name; zend_uint class_name_len; zend_bool array_type_hint; zend_bool allow_null; zend_bool pass_by_reference; zend_bool return_reference; int required_num_args; }; zend_module_entry * get_module() { return dget_module(); } } const int ZEND_MODULE_API_NO = 20050922; const ubyte ZEND_DEBUG = 0; const ubyte USING_ZTS = 0; zend_module_entry * dget_module() { static zend_module_entry ret = { zend_module_entry.sizeof, ZEND_MODULE_API_NO, ZEND_DEBUG, USING_ZTS, null, null "testd", null, &module_startup_func, null, null, null, null, //PHP_MINFO(xxx), "0.1", null, 0, 0, 0, null, 0 }; ret.functions = dzend_module_get_functions(); return &ret; } zend_function_entry* dzend_module_get_functions() { /*struct zend_function_entry { char *fname; void * handler; //void (*handler)(INTERNAL_FUNCTION_PARAMETERS); zend_arg_info *arg_info; zend_uint num_args; zend_uint flags; }; */ static zend_function_entry* ret= [ { "myname", null, // handler null, // arg_info cast(zend_uint) null.sizeof/zend_arg_info.sizeof -1, //numargs 0 // flags }, { null,null,null,0,0 } ]; return ret; } extern(C) { void module_startup_func(int type, int module_number) { printf("module init?"); } } void main() { }