Hi,
I'm using an older version as this is what that came when I downloaded GR a
few months ago and I haven't seen a need to change what I have installed.
I'm new to GR, Linux and Python so I'm more eager to debug what I have
without introducing even newer stuff.
Anyway, the earlier problem was due to a C++ bug affecting another thread.
This has been fixed. Now there's a problem with passing the packets created
in the C++ extension, called sm, to Python.
The following describes what I do, which is setting the callback, and then
calling the callback.
SETTING THE CALLBACK POINTER IN THE C++ EXTENSION
The Python call that is to receive the packet from the C++ extension is
inherited from null_mac class and is named self.fg.send_pkt(). It is passed
from a sub-class of null_mac in Python to the extension with:
sm.settx2llecallback(self.fg.send_pkt)
The corresponding C++ call is:
static PyObject*s_pcTxDnCallback=0;
...
static PyObject*sm_settx2llecallback(PyObject*a_pcSelf,PyObject*a_pcArgs)
{...
PyObject*l_pcCallback=0;
...
if(PyArg_ParseTuple(a_pcArgs,"O:set_callback",&l_pcCallback))
{
if(PyCallable_Check(l_pcCallback))
{...
Py_XINCREF(l_pcCallback);
s_pcTxDnCallback=l_pcCallback;
...
}
When the above executes, PyCallable_Check() seems to run with no error.
PASSING PACKETS FROM THE EXTENSION TO PYTHON CODE
Later, a packet is created in the C++ extension in the form of an unsigned
char array. To pass it to the Python IP tunneling code, I do the following:
BOOL Tx2PyLle(unsigned char*data,UINT16 len)
{
...
PyObject*l_pcArgs=0;
...
l_pcArgs=Py_BuildValue("(s#)",reinterpret_cast<char*>(data),static_cast<INT32>(len));
if(l_pcArgs )
{...
assert(s_pcTxDnCallback);
...;
PyObject*l_pcRet=PyEval_CallObject(s_pcTxDnCallback,l_pcArgs);
...
}
This function above has a segmentation fault at PyEval_CallObject().
My queries are:
1) Is the callback to Python passed and set correctly in the extension?
2) Is it right to assume that in Python, the packets are Python strings?
Thanks a lot,
Jeremy
----- Original Message -----
From: "Eric Blossom" <[EMAIL PROTECTED]>
To: "Jeremy Chew" <[EMAIL PROTECTED]>
Cc: <Discuss-gnuradio@gnu.org>
Sent: Tuesday, November 28, 2006 2:53 AM
Subject: Re: [Discuss-gnuradio] Problem with my modified IP tunnelling
example
On Mon, Nov 27, 2006 at 07:05:26PM +0800, Jeremy Chew wrote:
Hi,
I've tried the IP tunnelling example in
gnuradio-examples-0.7/python/gmsk2/tunnel_ip_null_mac.py and it seems to
work fine.
I've since been modifying the IP tunnelling example to use my MAC in
place
of null_mac. I have fixed the code to use the new MAC in the form of a
C++
extension.
However, now when I try to run the modified IP tunnelling example, the
program craches at either of two different points in __init__() of
transmit_path class with the message 'Floating exception'. The exact
crash
point seems to depend on which directory I run the example in.
What's wrong? What is a floating exception?
Thanks,
Jeremy
Sorry, I've got no clue.
Any particular reason you're using really old code?
Consider using gnuradio-3.0.2 or svn.
See http://gnuradio.org/trac/wiki
Eric
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio