B
buffinator
I have an application that has to send a string as a pointer to memory,
and then another one that has to retriece it and fetch the string.
Converting the string to an array and sending the pointer was easy
import array
a=array.array("c","mytextgoeshere")
my_pointer = a.buffer_info()[0]
But then I tried to get the data back... and I just can't find out how.
I ended up writing a C module for this that works fine in linux, but
this application is meant for windows and I just can't get C-modules to
compiler there correctly since I suck at windows.
The relevant code from the module is
static PyObject *
pointrtostr_casttostr(PyObject *self, PyObject *args)
{
char *mystr;
long int p;
if (!PyArg_ParseTuple(args, "l", &p))
return NULL;
mystr = (char*)p;
return Py_BuildValue("s", mystr);
}
My question is... can I do the above code in python without involving C
since it is quite a big hassle to have to go through the module building
in windows? :/
/buffis
and then another one that has to retriece it and fetch the string.
Converting the string to an array and sending the pointer was easy
import array
a=array.array("c","mytextgoeshere")
my_pointer = a.buffer_info()[0]
But then I tried to get the data back... and I just can't find out how.
I ended up writing a C module for this that works fine in linux, but
this application is meant for windows and I just can't get C-modules to
compiler there correctly since I suck at windows.
The relevant code from the module is
static PyObject *
pointrtostr_casttostr(PyObject *self, PyObject *args)
{
char *mystr;
long int p;
if (!PyArg_ParseTuple(args, "l", &p))
return NULL;
mystr = (char*)p;
return Py_BuildValue("s", mystr);
}
My question is... can I do the above code in python without involving C
since it is quite a big hassle to have to go through the module building
in windows? :/
/buffis