What I meant to say was that I did use zend_fetch_list_dtor_id in RINIT at
first, but I noticed that PHP was not calling RINIT. So then I migrated it
MINIT, which is called when the module is loaded.

Doubtful... PHP calls every module's RINIT at the start of every request. If you were "testing" RINIT by launching something like `php -m` or `php -i` or something then sure RINIT wouldn't be called. There's no actual request involved. In a real script execute it most certainly would call RINIT.

As for malloc/emalloc, I tried using malloc(sizeof(struct php_socket));
which did not work because gcc was erroring with "Incomplete datatype". I
then re-read the Zend API function list and came across emalloc, which I had
omitted when I first read it. So once I used emalloc, it worked.

The malloc/emalloc issue is genuine enough in that yes, you do need to be using the emalloc() family over the system malloc allocators (except in rare cases involving persistency).

The larger issue of the incomplete type comes from the fact that the form of your structure declaration means you'll want to get your size from sizeof(php_socket) not sizeof(struct php_socket).

typedef struct {
       PHP_SOCKET bsd_socket;
       int             type;
       int             error;
} php_socket;

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to