Hello to the php developer community - :)
This is my first post so I hope I'm not too out of line coming here to ask a
question.
My question is - With PHP could a C extension be written that takes the
binary contents of a variable in memory and writes it to a file or a stream?
Like:
struct abc{ int a;}X;
FILE*fp = fopen("abc.dat","wb");
fwrite(&X,sizeof(X),1,fp);
Basically I'm interested in using DBUS with PHP - Someone is already working
on an implementation ...
My question is could you take any arbitrary variable and send it over DBUS
in its C binary form.
That way 'the other side' of the DBUS connection could implement a similar
construct and interpret the binary data to its language-specific format.
This could go a long way to provide various forms of
inter-process-communication in a binary fashion to other Languages (such as
Python).
To start out with I would like to experiment with serialization of a
variable to a binary file - and see if I can get that working.
I realize there are some limitations here - recursive structures,
references, object references, pointer pointers - etc, I just don't know how
PHP implements it's data structures well enough to know how hard retrieving
simple arrays, integers, and strings from the applications memory would be.
Binary serialization is ideal because it eliminates any problems associated
with multi-byte strings, parsing overhead, etc.
It would be great if a PHP arrays structure could be taken from memory,
written to a file or stream, and opened in Python as a Dictionary without
any database or serialization inbetween.
If this overlaps with any current development please let me know.
Thanks,
Ben DeMott
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php