468,284 Members | 1,504 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

swig+structures -> python

Hi,

Please help me to solve this problem.
I have such function written in C:

search(
const char *base,
int scope,
const char *filter,
char **attrs,
LDAP_Entries **entries);

where LDAP_Entries is a structure.

When I call this function from Python, :
search("ou=applications;ou=general_data;o=zus,c=pl ",
SEARCH_SCOPE_SUBTREE,
"cn=KW_*",attrs,entries)
where :
attrs = ["cn","command"]
entries = []
it says:
TypeError: Type error. Expected _p_p_char

This function return data in entries parameter.
I dont want to have access to data in entries,but only an object (handler to
it), so I can put returned value in entris into other function,also called
from Python.
Do i have to make a typdef functions , so wrapper understands what I want to
have back ?

thanx for all your help,
mwallace.

Jul 18 '05 #1
1 2308
"mwallace1" <mw*******@wp.pl> schrieb im Newsbeitrag
news:bd**********@news.mch.sbs.de...
Hi,

Please help me to solve this problem.
I have such function written in C:

search(
const char *base,
int scope,
const char *filter,
char **attrs,
LDAP_Entries **entries);

where LDAP_Entries is a structure.

When I call this function from Python, :
search("ou=applications;ou=general_data;o=zus,c=pl ",
SEARCH_SCOPE_SUBTREE,
"cn=KW_*",attrs,entries)
where :
attrs = ["cn","command"]
entries = []
it says:
TypeError: Type error. Expected _p_p_char

This function return data in entries parameter.
I dont want to have access to data in entries,but only an object (handler to it), so I can put returned value in entris into other function,also called
from Python.
You might want to taka a look at
CObjects
http://www.python.org/doc/current/api/cObjects.html

especially PyCObject_FromVoidPointer and
PyCObject_AsVoidPointer
Regards,
Vincent Wehren

Do i have to make a typdef functions , so wrapper understands what I want to have back ?

thanx for all your help,
mwallace.

Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.