Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yugr/gcc-interp
Run C files as standalone scripts
https://github.com/yugr/gcc-interp
c cplusplus interpreter proof-of-concept script
Last synced: about 1 month ago
JSON representation
Run C files as standalone scripts
- Host: GitHub
- URL: https://github.com/yugr/gcc-interp
- Owner: yugr
- License: mit
- Created: 2019-05-05T14:23:34.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-01-18T00:19:36.000Z (about 3 years ago)
- Last Synced: 2024-11-07T04:47:25.194Z (3 months ago)
- Topics: c, cplusplus, interpreter, proof-of-concept, script
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 8
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
`gcci` allows to run C files as scripts, omitting the compilation step
(actually hiding it). Most importantly, modified file still remains
a valid C code and can be compiled by normal means.Self-executable C code is particularly useful when you make
a library of small examples/snippets.Example usage:
```
$ cat hello.c
#include
int main() {
printf("Hello world!\n");
return 0;
}# Insert "shebang"
$ gcci -i hello.c# Run!
$ ./hello.c
Hello world!
```You can also execute without instrumentation:
```
$ gcci hello.c
Hello world!
```If you get `gcci: command not found` error in last line, you need to add `gcci` to `PATH`
or use absolute path instead:
```
$ gcci -i -a ...
```To override default compilation flags (`-Wall -DNDEBUG -O2`) use `--compiler-flags` option
during instrumentation stage:
```
$ gcci -i --compiler-flags='-O0 -w' ...
````gcci` is based on a hack from [What's the appropriate Go shebang line?](https://stackoverflow.com/questions/7707178/whats-the-appropriate-go-shebang-line)
TODO:
* add compilation cache (in `$HOME/.gcci`)