Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embedding C Data into PHP objects. #2375

Open
rcmcdonald91 opened this issue Aug 7, 2022 · 0 comments
Open

Embedding C Data into PHP objects. #2375

rcmcdonald91 opened this issue Aug 7, 2022 · 0 comments

Comments

@rcmcdonald91
Copy link

rcmcdonald91 commented Aug 7, 2022

PHP internals supports a clever struct allocation hack that allows you to allocate arbitrary memory in front of zend_objects to store any C data. Then OffsetOf can be used to "find" this data later effectively allowing you to embed anything into a object. This is the NG replacement for the old resource type.

I'd like to start a discussion around supporting this in Zephir. As I believe it is a pretty significant shortcoming between the types of extensions one can write using the native C API vs the higher level Zephir DSL.

Maybe something like the function optimizers that we already have for calling C code. But an object optimizer that allows us to define the object structure and hook the object_handlers.

I understand PHP internals but Zephir internals is new to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant