TinyCC compiler bundle for windows
Project description
TinyCC (or tcc) is a small, fast C compiler capable of producing DLLs that can be loaded via ctypes. This version compiles for 64 bit Windows.
Compiler version: 0.9.26 (amd64) 2013-02-16
Installation of the compiler and the python interface is simply:
pip install tinycc
Full documentation for the compiler is available at http://bellard.org/tcc. Source and binaries are available from https://savannah.nongnu.org/projects/tinycc/.
TCC is the full path to the tcc.exe executable, wrapped in quotes so that it can be used as part of an os.system command even when it contains spaces. The function find_tcc_path() returns the path without quotes.
Usage example:
import os
from tinycc import TCC
COMPILE = TCC + " -shared -rdynamic -Wall %(source)s -o %(target)s"
source = "hello.c"
target = os.path.splitext(source)[0] + ".dll" # replace .c with .dll
command = COMPILE%{"source": source, "target": target}
status = os.system(command)
if status != 0 or not os.path.exists(target):
raise RuntimeError("compile failed. File is in %r"%source)
or more simply, use compile:
from tinycc import compile
dll_path = compile("hello.c")
Use data_files to gather the data files required for bundling tinycc in a py2exe package. This places the compiler in the tinycc-data directory beside the library.zip generated by py2exe. The following should appear in the setup.py for the py2exe build:
import tinycc
data_files = []
...
data_files.extend(tinycc.data_files())
...
setup(
...
data_files = data_files,
...
)
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
File details
Details for the file tinycc-1.0.1.tar.gz.
File metadata
- Download URL: tinycc-1.0.1.tar.gz
- Upload date:
- Size: 487.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec8226d5f3a527d48ea69dda97c1c6f5d10407dd38a8a27a78dcaed5b5933a5d
|
|
| MD5 |
5787889cc8a394c877d04afeed1056b9
|
|
| BLAKE2b-256 |
d7849b9ce2ac9d40b5946fb391d668f9ff89d1d045a4f8c4249c1746c6afa5d7
|