Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 8th, 2008, 12:07 AM   #1
PublicAutopsy
Newbie
 
Join Date: Apr 2008
Posts: 3
Rep Power: 0 PublicAutopsy is on a distinguished road
'C'oo'P'eration!

Alright is there any way to make a cooperative project between C++ and Python? Or do the literal language barriers prevent any sort of cooperation? Just wondering, cause as i said before my friend does C++ real nice, and im learning python so yeah.

(In case you didnt get it the C and P in cooperation is C++ and Python.)
PublicAutopsy is offline   Reply With Quote
Old Apr 8th, 2008, 4:19 AM   #2
lectricpharaoh
Caffeinated Neural Net
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Wet west coast of Canada
Posts: 864
Rep Power: 3 lectricpharaoh is on a distinguished road
Re: 'C'oo'P'eration!

I've never used Python, but this sort of thing will probably depend on your platform. As far as Windows goes, if you can call Windows API functions, then you should be able to compile a C++ .DLL and call functions in it from Python, since the Windows API is essentially a large collection of .DLL functions. The biggest hurdle is probably that Python is, as far as I know, an interpreted language, and C++ is compiled. I'm not sure how easy it would be to call Python code from C++, though.

Is there some particular aim, or are you just wanting to be able to both contribute to the same project(s)? If the latter, you might have better luck with C# or VB.NET, as both of these languages can interface with C++ pretty easily, at least on Windows. Of course, this assumes that the interoperability is difficult with Python, and like I said, I'm not sure of this.
__________________
A man's knowledge is like an expanding sphere, the surface corresponding to the boundary between the known and the unknown. As the sphere grows, so does its surface; the more a man learns, the more he realizes how much he does not know. Hence, the most ignorant man thinks he knows it all. - L. Sprague de Camp
lectricpharaoh is offline   Reply With Quote
Old Apr 8th, 2008, 4:57 PM   #3
Jessehk
The Oblivious One
 
Jessehk's Avatar
 
Join Date: May 2005
Location: Ontario, Canada
Posts: 610
Rep Power: 3 Jessehk is on a distinguished road
Re: 'C'oo'P'eration!

http://docs.python.org/ext/ext.html
http://www.boost.org/doc/libs/1_35_0...doc/index.html
__________________
Dr. Zoidberg: [ecstatic] I'm going to a movie... with FRIENDS!
Jessehk is offline   Reply With Quote
Old Apr 14th, 2008, 1:45 AM   #4
Game_Ender
Professional Programmer
 
Game_Ender's Avatar
 
Join Date: May 2006
Location: Maryland, USA
Posts: 304
Rep Power: 3 Game_Ender is on a distinguished road
Re: 'C'oo'P'eration!

In the project linked in my sig, we interface tens of thousands of C++ with thousands of lines of python. We have very deep interactions, include passing python functions into a C++ based event system. The only thing that is a pain is the Boost.Python build times. I recommend something like SWIG or Py++ if you want to easily wrap C++ code a large amount of C++ code.
__________________
Robotics @ Maryland AUV Team - Software Lead
Game_Ender is offline   Reply With Quote
Old Apr 14th, 2008, 3:16 PM   #5
titaniumdecoy
Expert Programmer
 
titaniumdecoy's Avatar
 
Join Date: Nov 2005
Posts: 777
Rep Power: 3 titaniumdecoy is on a distinguished road
Send a message via AIM to titaniumdecoy
Re: 'C'oo'P'eration!

You might be interested in Cython.
titaniumdecoy is offline   Reply With Quote
Old Apr 14th, 2008, 8:08 PM   #6
Jessehk
The Oblivious One
 
Jessehk's Avatar
 
Join Date: May 2005
Location: Ontario, Canada
Posts: 610
Rep Power: 3 Jessehk is on a distinguished road
Re: 'C'oo'P'eration!

I had heard about Lua through an article and I had never done any extending or embedding before so I thought I'd try something.

Lua is extremely light, both in terms of memory footprint and standard libraries. For my simple Arch Linux utility, I first extended Lua by writing a library of filesystem functions for the language, then embedded it in order to write the majority of the "logic" which I then wrapped together with C and built/packaged with autotools.

I don't know how useful it all was, but it was definitely very educational.
__________________
Dr. Zoidberg: [ecstatic] I'm going to a movie... with FRIENDS!
Jessehk is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:37 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC