diff options
| author | grischka <grischka> | 2016-05-12 10:25:50 +0200 |
|---|---|---|
| committer | grischka <grischka> | 2016-05-12 10:25:50 +0200 |
| commit | 5e4d0718ff4c860ac0961652ab8cb8cb2826ac84 (patch) | |
| tree | aca16ebc74910cb1651e2c4abe87f042c6988ff3 /examples/ex1.c | |
| parent | a66ba1f2a113c1f8b775c5c0a77061298fe5168e (diff) | |
| download | tinycc-5e4d0718ff4c860ac0961652ab8cb8cb2826ac84.tar.gz tinycc-5e4d0718ff4c860ac0961652ab8cb8cb2826ac84.tar.bz2 | |
tcc -E -P10 : output all numbers as decimals
This may be used to preprocess Fabrice Bellards initial revision
in this repository to demonstrate its capability to compile and
run itself (on i386 32-bit linux or windows).
Initial revision: 27f6e16bae9d0f73acec07f61aea696ab5adc680
Also needed:
* an empty stdio.h
* a wrapper named tc.c with
void expr(void);
void decl(int);
void next(void);
#include "tcc.c"
* an hello.c such as
int main()
{
printf("Hello World\n");
return 0;
}
All files with unix LF only lines. Then ...
* preprocess the source
$ tcc -E -P10 -I. tcc.c -o tc1.c
* compile the compiler
$ tcc -w -I. tc.c -o tc -ldl
* run it to compile and
run itself to compile and
run itself to compile and
run itself to compile and
run hello.c
$ ./tc tc1.c tc1.c tc1.c hello.c
--> Hello World!
------------------------------------------------------
* On i386 windows this may be added to the tc.c wrapper
#ifdef _WIN32
#include <windows.h>
void *dlsym(int x, const char *func)
{
if (0 == strcmp(func, "dlsym"))
return &dlsym;
return GetProcAddress(LoadLibrary("msvcrt"), func);
}
#endif
Diffstat (limited to 'examples/ex1.c')
0 files changed, 0 insertions, 0 deletions
