Embedding Py inside an Admin server program could be
extremly useful.
This is how I wish to embedd Py:
1. The server program runs on Windows NT. thus fork ()
is not applicable.
2. The server is Multi-User, thus Py needs to be
thread-safe - global variables need to be
eliminated or locked.
3. The server needs to process the input & output of
Py. furthermore, the server communicates with
clients in several methods, not all can be
represented with a FILE* object.
My request is that
a) Py will be made thread-safe, so several scripts
could be run simultaneously in the same process,
by different users.
b) Py will 'virtualize' IO in an object-oriented
like manner. This is difficult, since Py is
implemented in C, but not impossible.
consider this struct as a possible replacement
for FILE* & fprintf:
// typedef for 'this'
typedef void* VContext;
// typedef for function pointers
typedef void (p_vflush*)(VContext) // func. pointer
typedef void (p_vprintf*)(VContext,
const char *format,
....);
struct VOutput {
p_vflush vflush;
p_vprintf fprintf;
VContext vcontext;
};
it is fairly easy to implement FILE* style IO
using this style, and it allows a much more flexible
ways of doing IO.
The two major issues hold back embedding
|