470,591 Members | 1,458 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,591 developers. It's quick & easy.

Using C struct in Python** corrected


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.

Jun 7 '06 #1
0 966

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Christof Krueger | last post: by
reply views Thread by Richard Taylor | last post: by
138 posts views Thread by ambika | last post: by
2 posts views Thread by Martin v. LŲwis | last post: by
5 posts views Thread by Michael Sperlle | last post: by
3 posts views Thread by Sudheer Gupta | last post: by
2 posts views Thread by Pieter Rautenbach | last post: by
4 posts views Thread by hugo.arregui | last post: by
14 posts views Thread by eliben | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.