Re: [Tutor] c++ on python

2014-03-13 Thread Stefan Behnel
Russel Winder, 13.03.2014 17:29: > On Thu, 2014-03-13 at 16:57 +0100, Stefan Behnel wrote: > […] >> The thing is: if you have to write your own wrapper anyway (trivial or >> not), then why not write it in Cython right away and avoid the intermediate >> plain C level? > > If the task is two write a

Re: [Tutor] c++ on python

2014-03-13 Thread Stefan Behnel
James Chapman, 13.03.2014 17:35: > Perhaps I should look into Cython as I'm currently working on a > project that utilises a C API. > > I've been finding that getting the data types to be exactly what the C > API is expecting to be the hardest part. > > With the original question in mind, here's

Re: [Tutor] c++ on python

2014-03-13 Thread James Chapman
Perhaps I should look into Cython as I'm currently working on a project that utilises a C API. I've been finding that getting the data types to be exactly what the C API is expecting to be the hardest part. With the original question in mind, here's an example calling into a C++ external C API:

Re: [Tutor] c++ on python

2014-03-13 Thread Russel Winder
On Thu, 2014-03-13 at 16:57 +0100, Stefan Behnel wrote: […] > The thing is: if you have to write your own wrapper anyway (trivial or > not), then why not write it in Cython right away and avoid the intermediate > plain C level? If the task is two write an adapter (aka wrapper) then perhaps use SWI

Re: [Tutor] c++ on python

2014-03-13 Thread Stefan Behnel
Alan Gauld, 12.03.2014 23:05: > On 12/03/14 16:49, Stefan Behnel wrote: >> Alan Gauld, 12.03.2014 10:11: >>> If it were a library then you would have to call >>> the individual C++ functions directly using >>> something like ctypes, which is usually more >>> complex. >> >> ctypes won't talk to C++,

Re: [Tutor] c++ on python

2014-03-13 Thread Oscar Benjamin
On 7 March 2014 14:29, Gabriele Brambilla wrote: > Hi, > in the next days I will receive a c++ code that I would like to run in > python (http://docs.python.org/2/extending/index.html). > It should be self consistent (no extraroutines). > I want to be ready to use it... Has someone some C++ code

Re: [Tutor] c++ on python

2014-03-13 Thread Russel Winder
On Wed, 2014-03-12 at 22:05 +, Alan Gauld wrote: > On 12/03/14 16:49, Stefan Behnel wrote: > > Alan Gauld, 12.03.2014 10:11: > >> If it were a library then you would have to call > >> the individual C++ functions directly using > >> something like ctypes, which is usually more > >> complex. > >

Re: [Tutor] c++ on python

2014-03-12 Thread Alan Gauld
On 12/03/14 16:49, Stefan Behnel wrote: Alan Gauld, 12.03.2014 10:11: If it were a library then you would have to call the individual C++ functions directly using something like ctypes, which is usually more complex. ctypes won't talk to C++, but Cython can do it quite easily. I thought it w

Re: [Tutor] c++ on python

2014-03-12 Thread Stefan Behnel
Alan Gauld, 12.03.2014 10:11: > If it were a library then you would have to call > the individual C++ functions directly using > something like ctypes, which is usually more > complex. ctypes won't talk to C++, but Cython can do it quite easily. Stefan __

Re: [Tutor] c++ on python

2014-03-12 Thread Alan Gauld
On 11/03/14 14:27, Gabriele Brambilla wrote: Is it a library or a program? A program. it should use only standard C++ libraries. OK, If it's a program, that is, it compiles into an executable that you can run then you can run it from within Python using the subprocess module. Do you know

Re: [Tutor] c++ on python

2014-03-11 Thread Gabriele Brambilla
I answer in the text 2014-03-11 9:32 GMT-04:00 ALAN GAULD : > CC'ing the list > Please use ReplyAll when responding. > > > -- > *From:* Gabriele Brambilla > *To:* Alan Gauld > *Sent:* Tuesday, 11 March 2014, 12:54 > *Subject:*

Re: [Tutor] c++ on python

2014-03-11 Thread ALAN GAULD
CC'ing the list Please use ReplyAll when responding.   > > From: Gabriele Brambilla >To: Alan Gauld >Sent: Tuesday, 11 March 2014, 12:54 >Subject: Re: [Tutor] c++ on python > > > >I think (because I've not received th

Re: [Tutor] c++ on python

2014-03-07 Thread Alan Gauld
On 07/03/14 14:29, Gabriele Brambilla wrote: in the next days I will receive a c++ code that I would like to run in python (http://docs.python.org/2/extending/index.html). What do you mean? Are you receiving C++ source code? If so is it for an executable program, a library or just a single ob

Re: [Tutor] c++ on python

2014-03-07 Thread eryksun
On Fri, Mar 7, 2014 at 9:29 AM, Gabriele Brambilla wrote: > > in the next days I will receive a c++ code that I would like to run in > python (http://docs.python.org/2/extending/index.html). > It should be self consistent (no extraroutines). > I want to be ready to use it... Has someone some C++

[Tutor] c++ on python

2014-03-07 Thread Gabriele Brambilla
Hi, in the next days I will receive a c++ code that I would like to run in python (http://docs.python.org/2/extending/index.html). It should be self consistent (no extraroutines). I want to be ready to use it... Has someone some C++ code examples available that I can try to run easily before getti