donno2048 / pyc4

A Python extension to run C code in Python.

Home Page:https://pypi.org/project/pyc4/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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");
...     return 0;
... }
... """)
hi
exit code: 0
>>> c4.execute(r"""
... int main(int argc, char **argv) {
...     printf("%s", argv[0]);
...     return 0;
... }
... """, "hi")
hi
exit code: 0

About

A Python extension to run C code in Python.

https://pypi.org/project/pyc4/

License:GNU General Public License v2.0


Languages

Language:C 96.1%Language:Python 3.9%