473,614 Members | 2,342 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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=appl ications;ou=gen eral_data;o=zus ,c=pl",
SEARCH_SCOPE_SU BTREE,
"cn=KW_*",attrs ,entries)
where :
attrs = ["cn","comma nd"]
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 2519
"mwallace1" <mw*******@wp.p l> 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=appl ications;ou=gen eral_data;o=zus ,c=pl",
SEARCH_SCOPE_SU BTREE,
"cn=KW_*",attrs ,entries)
where :
attrs = ["cn","comma nd"]
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_FromV oidPointer and
PyCObject_AsVoi dPointer
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2070
by: ScratchMonkey | last post by:
I'm working on a system which exposes TCL scripting but looks to be difficult to extend with a native binary. I need to build a "front end" for it that has lots of complicated data structures and can benefit from strong typing, so C++ is a more natural choice for implementation. Does there exist a C++ compiler that generates TCL as its output?
5
7218
by: emmanuel.rivoire | last post by:
Hello, I spent almost a week to be able to embed Python within my C++ game engine. I wrote a mini-tutorial of what I was able to do so far here : http://forums.indiegamer.com/showpost.php?p=169352&postcount=9 At the end of my tutorial, I wrote : "You can do the same with C++ classes, and with structures within structures. Swig can parse & wrap most C/C++ declarations."
0
8197
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8640
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8589
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8443
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6093
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5548
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4058
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4136
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.