After my last post outlining the concept of PCL, I’ve now published a working minimal compiler and runner for .pcl files—combining embedded Python and C into a single file and simplifying native extension workflows.
✅ Features Implemented
Extracts %c ... %endc and %py ... %endpy blocks
Compiles C code into .so shared libraries using gcc
Auto-generates ctypes wrappers (no manual binding)
Runs Python with native C functions fully linked
Supports:
Function exports/imports
Global variables (basic)
C-to-Python callbacks via CFUNCTYPE
.pyz packaging (optional created using --onefile )
Organizes output in build/ and dist/ folders
Simple CLI: build, run, clean, --onefile
Tested Environment
OS: Xubuntu 24.04.2 LTS
Platform: VMware Workstation 17
Tools: Python 3.7+, GCC
Dependencies: None (pure standard library)
Known Limitations
Only basic support for struct, enum, and global variables
No deep C parsing — metadata must guide behavior
No cross-platform testing yet (Linux only)
Callbacks assume int func(int)-like signatures
Symbol hiding is off by default unless manually specified
This is just the first step—a minimal but working proof-of-concept focused on clean integration without overcomplication. Feedback is welcome!
GitHub: https://github.com/hejhdiss/pcl
hashtag#python hashtag#cprogramming hashtag#opensource hashtag#compilerdesign hashtag#ctypes hashtag#pcl hashtag#buildtools hashtag#lowlevel hashtag#pythondev hashtag#linux
Top comments (0)