473,324 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Compile C program -> .pyc file

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
5 2145
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
"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

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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: jrefactors | last post by:
If the C programs have UNIX system calls such as fork(), alarm(), etc.., we should call it UNIX programs, not traditional C programs? We couldn't compile the programs with system calls using VC++...
3
by: Yang Zhang | last post by:
Here is a program: ///////////////////////////////////////////////// #include <iostream> using namespace std ; class A { int a ; A(const A& aA) { a=aA.a ; cout<<"copy constructor...
8
by: Davy | last post by:
Hi all, I use VC and gcc/gdb to compile and debug C/C++ files. But I found some of the debug version of the compiled files are too large to be run in a small RAM. Can I compile C/C++ Debug...
16
by: John Kelsey | last post by:
Back in the "old" days with C, I used to do something like... struct { char Description; float price; } Items = { {"Apple", 1.99}, {"Banana", 2.04}
4
by: John Smith | last post by:
Hi I'm porting some C++ code to new platforms and have some 1-byte aligned structures which need a specific size. Since datatypes can vary on different platforms (which I found out the hard way...
9
by: nickyeng | last post by:
In java environment, i compile and run program using "javac" and "java" respectively. So, now is C++. Compile c++ program (hello.cpp) , we type: $ g++ testing.cpp and to run that...
109
by: zaidalin79 | last post by:
I have a java class that goes for another week or so, and I am going to fail if I can't figure out this simple program. I can't get anything to compile to at least get a few points... Here are the...
5
by: wong_powah | last post by:
#include <vector> #include <iostream> using std::cout; using std::vector; enum {DATASIZE = 20}; typedef unsigned char data_t;
2
by: BruceWho | last post by:
I downloaded boost1.35.0 and built it with following command: bjam --toolset=msvc-7.1 --variant=release --threading=multi -- link=shared --with-system stage and it failed to compile, error...
30
by: Anarki | last post by:
The following is the program i am trying to compile //restrict.c #include <stdio.h> int main() { char arr = "Qualifiers" char * restrict p = arr; int i = 0; for(; i < 10; ++i)
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.