![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Apr 2008
Posts: 3
Rep Power: 0
![]() |
'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.) |
|
|
|
|
|
#2 |
|
Caffeinated Neural Net
![]() Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 1,010
Rep Power: 5
![]() |
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.
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot. - Vaarsuvius, Order of the Stick |
|
|
|
|
|
#3 |
|
The Oblivious One
Join Date: May 2005
Location: Ontario, Canada
Posts: 641
Rep Power: 4
![]() |
Re: 'C'oo'P'eration!
__________________
Dr. Zoidberg: [ecstatic] I'm going to a movie... with FRIENDS! |
|
|
|
|
|
#4 |
|
Professional Programmer
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3
![]() |
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 |
|
|
|
|
|
#5 |
|
Expert Programmer
|
Re: 'C'oo'P'eration!
You might be interested in Cython.
|
|
|
|
|
|
#6 |
|
The Oblivious One
Join Date: May 2005
Location: Ontario, Canada
Posts: 641
Rep Power: 4
![]() |
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! |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|