Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #58797 > unrolled thread
| Started by | Oscar Benjamin <oscar.j.benjamin@gmail.com> |
|---|---|
| First post | 2013-11-08 14:37 +0000 |
| Last post | 2013-11-08 15:04 +0000 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Talking to a 'C' program Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-11-08 14:37 +0000
Re: Talking to a 'C' program Grant Edwards <invalid@invalid.invalid> - 2013-11-08 15:04 +0000
| From | Oscar Benjamin <oscar.j.benjamin@gmail.com> |
|---|---|
| Date | 2013-11-08 14:37 +0000 |
| Subject | Re: Talking to a 'C' program |
| Message-ID | <mailman.2221.1383921481.18130.python-list@python.org> |
On 8 November 2013 14:23, John Pote <johnhpote@o2.co.uk> wrote: > Hi all, > > I have the task of testing some embedded 'C' code for a small micro-controller. Thought it would be a good idea to test it on the PC first to make sure the algorithm is correct then perhaps test it on the controller via RS232 and an appropriate wrapper round the 'C' functions. > > On the PC I can use Python's unit test library module and logging to create a nice and easy to use environment (I like Python). So my question is how to communicate from Python to the C module on the PC. What I'd like is simplicity and ease of setting up. All I can think of myself is to use sockets. > > Any ideas on how to do this would be gratefully appreciated. Have a look at Cython: http://cython.org/ This enables you to call C code from Python code within the same process. > Also as I don't have any microsoft offerings of a C compiler any suggestions as to a suitable C compiler for a PC appreciated as well. llvm? mingw? gcc? I assume that by "PC" you mean Windows in which case mingw is a fine choice and is officially supported by Cython. Oscar
[toc] | [next] | [standalone]
| From | Grant Edwards <invalid@invalid.invalid> |
|---|---|
| Date | 2013-11-08 15:04 +0000 |
| Message-ID | <l5iuh3$1ig$2@reader1.panix.com> |
| In reply to | #58797 |
On 2013-11-08, Oscar Benjamin <oscar.j.benjamin@gmail.com> wrote:
> On 8 November 2013 14:23, John Pote <johnhpote@o2.co.uk> wrote:
>> Hi all,
>>
>> I have the task of testing some embedded 'C' code for a small
>> micro-controller. Thought it would be a good idea to test it on the
>> PC first to make sure the algorithm is correct then perhaps test it
>> on the controller via RS232 and an appropriate wrapper round the 'C'
>> functions.
>>
>> On the PC I can use Python's unit test library module and logging to
>> create a nice and easy to use environment (I like Python). So my
>> question is how to communicate from Python to the C module on the PC.
>> What I'd like is simplicity and ease of setting up. All I can think
>> of myself is to use sockets.
>>
>> Any ideas on how to do this would be gratefully appreciated.
>
> Have a look at Cython:
> http://cython.org/
>
> This enables you to call C code from Python code within the same
> process.
You can also use c-types for that
http://docs.python.org/2/library/ctypes.html#module-ctypes
I've used Python/ctypes to exercise libraries written in C, but I've
never done it under Windows. However, others have:
http://hakantiftikci.wordpress.com/2009/11/14/generating-dll-using-mingw-and-using-them-in-python-via-ctypes/
--
Grant Edwards grant.b.edwards Yow! Give them RADAR-GUIDED
at SKEE-BALL LANES and
gmail.com VELVEETA BURRITOS!!
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web