Writing 'C' structures out in cPickle format?

C

Chance Ginger

I have a problem that I am trying to solve. I have two different
systems - one written in C and another in Python. I would like the
two to exchange some information.

On the Python side I decided to use cPickle. On the C side I would
write a library that can read the cPickle and generate the correct
C structure (the data is, more or less, self-describing) and visa
versa.

I was wondering if anyone has done something like this before
and if so can they point me to information on how to easily do it?
The structures I am using on the C side are pretty simple (very
flat and using only integers and strings).
 
D

Diez B. Roggisch

On the Python side I decided to use cPickle. On the C side I would
write a library that can read the cPickle and generate the correct
C structure (the data is, more or less, self-describing) and visa
versa.

I was wondering if anyone has done something like this before
and if so can they point me to information on how to easily do it?
The structures I am using on the C side are pretty simple (very
flat and using only integers and strings).

I guess it might be the more sensible choice to use module struct and
transform your python-data to C-structs. The reason is simply that to teach
the old dog C new tricks (namely react flexible on cPickle) is a hard task,
whereas customizing python objects serialization is comparably easy.

Diez
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top