Using C struct in Python** corrected

S

Sudheer Gupta

Hi,

I am having trouble using C struct in python. Hope anyone can help me
out ...

Say, I have my C struct as

typedef struct call
{
struct call *next;
// .....

} call_t;

I have a global variable, namely call_pool, which is of type call_t *


My python program:

cp = call_pool # no error doing this, means that call_pool is accessable

while cp:
print cp
cp = cp.next


This is giving me error: " There is no member or method name c_next"

Now, If I just do:

print cp
print cp.next

there is no problem. But I am seeing a difference in the way python is
looking at the struct:

print cp -> (call_t*) 0xb0...
print cp.next -> (struct call *) 0xb0...


Is python not intelligent enough to diagnose the next pointer ??

Responses appreciated.

Thanks
Sudheer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top