By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,630 Members | 1,252 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,630 IT Pros & Developers. It's quick & easy.

Compile C program -> .pyc file

P: n/a
Is there a way to compile a C program into a .pyc file that has the
same behavior as the compiled C program?

Thanks!

Oct 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Ernesto wrote:
Is there a way to compile a C program into a .pyc file that has the
same behavior as the compiled C program?

Thanks!

Here's a start:

http://codespeak.net/pipermail/pypy-...q1/000198.html

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/

Oct 21 '05 #2

P: n/a
"Ernesto" wrote:
Is there a way to compile a C program into a .pyc file that has the
same behavior as the compiled C program?


unless you find a C->Python compiler, no. PYC files contain Python bytecode,
C compilers usually generate native code for a given machine platform.

</F>

Oct 21 '05 #3

P: n/a

Fredrik Lundh wrote:
"Ernesto" wrote:
Is there a way to compile a C program into a .pyc file that has the
same behavior as the compiled C program?


unless you find a C->Python compiler, no. PYC files contain Python bytecode,
C compilers usually generate native code for a given machine platform.

</F>

Yeah, I know it can't really be done in ONE step, but I was hoping it
was possible in 'n' steps.

Oct 21 '05 #4

P: n/a
Steve Holden wrote:
Here's a start:

http://codespeak.net/pipermail/pypy-...q1/000198.html


if anyone could turn ideas that only exist in Christian's brain into working systems,
the world would look a lot different.

</F>

Oct 21 '05 #5

P: n/a
On 2005-10-21, Fredrik Lundh <fr*****@pythonware.com> wrote:
Is there a way to compile a C program into a .pyc file that
has the same behavior as the compiled C program?
unless you find a C->Python compiler, no.


Or a C->Python-byte-code compiler.
PYC files contain Python bytecode, C compilers usually
generate native code for a given machine platform.


Generating byte-code for a stack-based virtual machine used to
be fairly popular for Pascal. [I once typed in from a book a
Pascal compiler in 8080 assembly language that generate
P-code.] Generating Python byte code from Pascal wouldn't be
terribly difficult, but doing so for C would be pretty tough
because you'd have to figure out how to fake all the low-level
pointer shenanigans which C allows (or some would say depends
upon).

--
Grant Edwards grante Yow! Are we live or
at on tape?
visi.com
Oct 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.