Skip to main content

A Python extension to run C code in Python

Project description

pyc4

A Python extension to run C code in Python based on c4.

Install

pip install pyc4

Use

The first argument is the code the rest are the argv

>>> import c4
>>>
>>> c4.execute(r"""
... int main() {
...     printf("hi\n");
...     return 0;
... }
... """)
hi
0
>>> c4.execute(r"""
... int main(int argc, char **argv) {
...     printf("%s\n", argv[0]);
...     return 1;
... }
... """, "hi")
hi
1

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyc4-1.0.1.tar.gz (13.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page