![]() |
'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.) |
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. |
Re: 'C'oo'P'eration!
|
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.
|
Re: 'C'oo'P'eration!
You might be interested in Cython.
|
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. |
| All times are GMT -5. The time now is 9:58 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC