First cpp stands for C Pre Processor, this tool usually does macro substitution in c, objective c, c++. Hence Cpp in the object is pretty much confusing when it seems to be talking about C++.
2012/4/27 Benjamin Root <ben.r...@ou.edu>: > > > On Fri, Apr 13, 2012 at 4:24 PM, Ignas Anikevicius <anikevic...@gmail.com> > wrote: >> >> Dear all, >> >> I was wondering if it is possible to use matplotlib from C++ directly >> and I have found an example on how to do this on StackOverflow: >> >> Hello, >> http://stackoverflow.com/questions/2509156/anyone-knows-a-matplotlib-equivalent-in-c-or-c >> > > Well, using that "method", you could interface with any python libraries in > C++, but you wouldn't be able to do anything useful. > I dont quite get it Ben. The stackoverflow is pretty revelant. using #include <python.h> is smart: you can avoid all the free/malloc in GC byt using python data structure and use this in your C code. And I know C/C++ dev using this trick in real open source project since python.h is less complicated to use than all the kombinat from boost. But, I would not use this method. (Question of taste and of complexity). There is another simpler solution however : Do everything in python : python is a very powerfull gluing langage, the GIL ensuring that non thread-safe code is thread safe, it is very forgiving with code not design for concurrency. ***** ctypes permits the direct loading and binding with C++ classes, or C functions. http://stackoverflow.com/questions/1615813/how-to-use-c-classes-with-ctypes http://docs.python.org/library/ctypes.html **** Another solution that seems impressive, is writing C/C++ extensions in python. It is very easy (I self learnt it in one day even though IQ test rank me 20 points below average). http://docs.python.org/extending/extending.html The benefit is you could use your C++ code to return native python object (set, array, dict, string, unicode, int (arbitrary long int) ...). My advice for big stream of data is you can return an iterator on the stream of data, thus limiting the memory usage if it is important (dont if you dont need it, premature optimization is the root of all evil). if your c++ code becomes an extension of python, it's deployment in an ecosystem of python instances will be made easier through the use of distribute. This gluing will ensure your data will flow without all the quirks related to popen (caching of stdout/in, no control on mermory use , interruptions, portability issues ...). The first solution is easy to achieve, the second solution requires more time but is funnier. Cheers; -- Jul ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users