Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > swig+structures -> python

Reply
Thread Tools

swig+structures -> python

 
 
mwallace1
Guest
Posts: n/a
 
      06-25-2003
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.



 
Reply With Quote
 
 
 
 
vincent wehren
Guest
Posts: n/a
 
      06-25-2003
"mwallace1" <> schrieb im Newsbeitrag
news:bdbpm6$91m$...
> 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.
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: [Python-Dev] [python-committers] [RELEASED] Python 3.2 rc 1 R. David Murray Python 0 01-17-2011 02:23 PM
Re: [Python-Dev] [python-committers] [RELEASED] Python 3.2 rc 1 Senthil Kumaran Python 0 01-17-2011 10:31 AM
Re: [Python-Dev] [Python-3000] RELEASED Python 2.6a1 and 3.0a3 Martin v. Löwis Python 0 03-01-2008 10:51 PM
Re: [Python-Dev] [Python-3000] RELEASED Python 2.6a1 and 3.0a3 Paul Moore Python 0 03-01-2008 10:39 PM
Searching comp.lang.python/python-list@python.org (was: UTF-8) skip@pobox.com Python 0 03-10-2007 02:50 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57