473,396 Members | 2,039 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,396 software developers and data experts.

Calling C/C++ functions in a python script

I'm kind of beginner in Python, so I must ask what are probably silly
questions.

Here is my problem:

I have a static library say, a file library.lib, which can be linked to
C or C++ programs.

Now I would like to use the functions of the library in Python script,
under Win XP.

Can someone give me a simple example of how to do so?

Thanks a lot,

Jean-Claude

Please reply also to ch********@tele2.fr

May 10 '06 #1
4 1414
If all you have are functions, the easiest is to create a simple dll/so
and load it into Python with ctypes.
http://starship.python.net/crew/thel.../tutorial.html

For more advanced needs, take a look at some of the extending options
available.
http://www.suttoncourtenay.org.uk/du...ingpython.html

May 10 '06 #2

Ravi Teja a écrit :

For more advanced needs, take a look at some of the extending options
available.
http://www.suttoncourtenay.org.uk/du...ingpython.html


Thanks for your answer. It is just what I'm trying to do.
Unfortunately, apparently I need a
"pyhton24_d.lib" to link to that does not seem to exists. Do you know a
solution for this?

Thanks a lot,

Jean-Claude

May 11 '06 #3
ch********@tele2.fr wrote:

Ravi Teja a écrit :

For more advanced needs, take a look at some of the extending options
available.
http://www.suttoncourtenay.org.uk/du...ingpython.html


Thanks for your answer. It is just what I'm trying to do.
Unfortunately, apparently I need a
"pyhton24_d.lib" to link to that does not seem to exists. Do you know a
solution for this?

Thanks a lot,

Jean-Claude


You can be build it from source! /Carl
May 11 '06 #4
You are working with the debug configuration, use release instead and
python24.lib will suffice.

http://news.hping.org/comp.lang.pyth...hive/6741.html

May 12 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Charles Larry | last post by:
Is there a way to define functions after the main part of a Python script? Example: #!/usr/local/bin/python # this code yields a NameError print_message("hello world")
18
by: bart_nessux | last post by:
I need a script to call several functions at the same time. How does one call more than one function simultaneously?
22
by: Brad Tilley | last post by:
Is it possible to write a file open, then read program in C and then call the C program from a Python script like this: for root, files, dirs in os.walk(path) for f in files: try:...
1
by: delrocco | last post by:
Hello, I really appreciate anyone who has time to read this and help, Thanks up front. I'm very new to python, having picked it up for the first time a week ago, but I feel I'm very close to...
6
by: Yevgeniy (Eugene) Medynskiy | last post by:
Hi all, This is probably a very newbie question, but after searching google and docs @ python.org I can't find an answer, so maybe someone would be able to help? I'd like to call command-line...
3
by: Mohammed Smadi | last post by:
Hi; Does anyone know if we can call matlab for a python or bash script while feeding the matlab script some command line arguments? I have an interactive matlab script which i want to automate...
3
by: David Bear | last post by:
I have a hash function written by another organization that I need to use. It is implemented in perl. I've been attempting to decode what they are doing in their hash function and it is taking way...
2
by: Graham Menhennitt | last post by:
I have a large Python 2.5 program that I want my users to be able to "extend" using a Python script. However, I want their script to run in a sandbox within the overall program so that they only...
1
by: joeedh | last post by:
Hi I'm getting extremely odd behavior. First of all, why isn't PyEval_EvalCode documented anywhere? Anyway, I'm working on blender's python integration (it embeds python, as opposed to python...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...
0
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...
0
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...

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.