473,385 Members | 2,269 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

from c++ to python

luke14free
Hello to all,
I am a python user and i would like to use a c++ extension in python (because i am forced to do that!) but i dont know where to start, on the where there are:

1) swig that requires a mid passage and requires a knowledge of cpp(that i really dont have)
2)pycxx that comes without docs and hasnt got any documentation on the web

Thank you

ps: if you want to see the script i am trying to use in python goto:

http://forum.nokia.com/info/sw.nokia.com/id/8b3a6ed3-e833-4f7c-aee1-4c773196f894/S60_Platform_Full-Duplex_Audio_Example_v2_0_en.zip.html

PS: I am posting the same post on the c/c++ forum in order to see if anyone knows how to solve my problem there.

Thank you,
Best regards
(feel free to correct my english)
May 8 '07 #1
5 1306
bartonc
6,596 Expert 4TB
Hello to all,
I am a python user and i would like to use a c++ extension in python (because i am forced to do that!) but i dont know where to start, on the where there are:

1) swig that requires a mid passage and requires a knowledge of cpp(that i really dont have)
2)pycxx that comes without docs and hasnt got any documentation on the web

Thank you

ps: if you want to see the script i am trying to use in python goto:

http://forum.nokia.com/info/sw.nokia.com/id/8b3a6ed3-e833-4f7c-aee1-4c773196f894/S60_Platform_Full-Duplex_Audio_Example_v2_0_en.zip.html

PS: I am posting the same post on the c/c++ forum in order to see if anyone knows how to solve my problem there.

Thank you,
Best regards
(feel free to correct my english)
A third option (which I have experience with - tried SWIG - too complicated) that might work for you is the ctypes module. It's included in version 2.5 and can be added to 2.4 (maybe even 2.3). It's basically a DLL loader with varailbe types that can be passed directly to C. I use it quite often for advance Window programming and it works very well.

Hope that helps,
Barton
May 8 '07 #2
very nice answer! Do you remember me? I am the man of the process handling, and you suggested me to use ctypes...And it worked...
How could i didn't remember for a c library??

Thank you
May 8 '07 #3
Sorry, i have just check the compatibility of dlls with python for nokia series 60 and it is uncompatible...what a pity, it would have been great!
so, have you got other ideas?

Thank you
May 8 '07 #4
bartonc
6,596 Expert 4TB
Sorry, i have just check the compatibility of dlls with python for nokia series 60 and it is uncompatible...what a pity, it would have been great!
so, have you got other ideas?

Thank you
The ctypes module is capable of handling libraries compiled with different call types:
windll uses stdcall. There are others that I'm not familiar with and I dont't have 2.5 installed on this maching. But this online doc says:
You load libraries by accessing them as attributes of these objects. cdll loads libraries which export functions using the standard cdecl calling convention, while windll libraries call functions using the stdcall calling convention.
May 8 '07 #5
So i should (using software a svisual studio...) create dlls with inside all the modules that i needed in c and then call them with python...it seems not so easy...
and however please look ath this http://pymbian.sourceforge.net/misc/statichack/INFO

Best regards,
Luke14free
May 8 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: hokiegal99 | last post by:
This script works as I expect, except for the last section. I want the last section to actually remove all spaces from the front and/or end of filenames. For example, a file that was named " test ...
2
by: satish | last post by:
Hello all, I have a shared object executable viz. *cable* which I execute as follows : $ ansyscust71 -custom cable -p ANSYSRF **ansyscust71 is a shell script and is a part of a software...
2
by: Jorgen Grahn | last post by:
I couldn't think of a good solution, and it's hard to Google for... I write python command-line programs under Win2k, and I use the bash shell from Cygwin. I cannot use Cygwin's python package...
1
by: John fabiani | last post by:
Hi, I have a script that is not running on a freeBSD 4.4 with Python 2.1 that uses ftplib. I'm wondering if it's possible to update only the ftplib module from 2.1 to 2.3. I only ask because I...
13
by: Ajay | last post by:
hi! can you call a Python application from a Java program? does this require any additional package to be installed? thanks cheers
9
by: Nico Grubert | last post by:
Hi there, Background of this question is: I want to convert all words <word> except 'and' / 'or' / 'and not' from a string into '*<word>*'. Example: I have the following string: "test and...
7
by: alexandre_irrthum | last post by:
Hi there, I am trying to use pyserial to read data from a temperature logger device (T-logger). T-logger is based on the DS1615 temperature recorder chip (Dallas Semiconductor). According to the...
13
by: DH | last post by:
Hi, I'm trying to strip the html and other useless junk from a html page.. Id like to create something like an automated text editor, where it takes the keywords from a txt file and removes them...
7
by: Ron Adam | last post by:
from __future__ import absolute_import Is there a way to check if this is working? I get the same results with or without it. Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) on win 32 ...
1
by: Martin Rubey | last post by:
Dear all, I'm trying to call from common lisp functions written for Sage (www.sagemath.org), which in turn is written in python. To do so, I tried...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...

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.