Compile C program -> .pyc file

E

Ernesto

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

Thanks!
 
F

Fredrik Lundh

Ernesto said:
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>
 
E

Ernesto

Fredrik said:
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.
 
G

Grant Edwards

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).
 

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

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top