5 This file contains specific information for usage of TinyCC
6 under MS-Windows. See tcc-doc.html to have all the features.
9 Installation from the binary ZIP package:
10 -----------------------------------------
11 Unzip the package to a directory of your choice.
16 To be able to invoke the compiler from everywhere on your computer by
17 just typing "tcc", please add the directory containing tcc.exe to your
21 Include and library search paths
22 --------------------------------
23 On windows, the standard "include" and "lib" directories are searched
24 relatively from the location of the executables (tcc.exe, libtcc.dll).
29 Open a console window (DOS box) and 'cd' to the examples directory.
31 For the 'Fibonacci' example type:
35 For the 'Hello Windows' GUI example type:
39 For the 'Hello DLL' example type
42 tcc -impdef dll.dll (optional)
43 tcc hello_dll.c dll.def
46 Using libtcc as JIT compiler in your program
47 --------------------------------------------
48 Check out the 'libtcc_test' example:
50 - Running it from source:
51 tcc -I libtcc libtcc/libtcc.def -run examples/libtcc_test.c
54 tcc examples/libtcc_test.c -I libtcc libtcc/libtcc.def
56 - Compiling with MinGW:
57 gcc examples/libtcc_test.c -I libtcc libtcc.dll -o libtcc_test.exe
59 - Compiling with MSVC:
60 lib /def:libtcc\libtcc.def /out:libtcc.lib
61 cl /MD examples/libtcc_test.c -I libtcc libtcc.lib
64 Import Definition Files:
65 ------------------------
66 To link with Windows system DLLs, TCC uses import definition
67 files (.def) instead of libraries.
69 The now built-in 'tiny_impdef' program may be used to make
70 additional .def files for any DLL. For example
72 tcc -impdef [-v] opengl32.dll [-o opengl32.def]
74 Put opengl32.def into the tcc/lib directory. Specify -lopengl32 at
75 the TCC commandline to link a program that uses opengl32.dll.
80 The system header files (except _mingw.h) are from the MinGW
85 From the windows headers, only a minimal set is included. If you need
86 more, get MinGW's "w32api" package. Extract the files from "include"
87 into your "tcc/include/winapi" directory.
92 TCC can link windows resources in coff format as generated by MinGW's
93 windres.exe. For example:
95 windres -O coff app.rc -o appres.o
96 tcc app.c appres.o -o app.exe
101 The now built-in tiny_libmaker tool by Timovj Lahde can be used as
102 'ar' replacement to make a library from several object files:
104 tcc -ar [rcsv] library objectfiles ...
107 Compilation from source:
108 ------------------------
109 * You can use the MinGW and MSYS tools available at
112 Untar the TCC archive and type in the MSYS shell:
113 ./configure [--prefix installpath]
117 The default install location is c:\Program Files\tcc
119 * Alternatively you can compile TCC with just GCC from MinGW using
120 > build-tcc.bat (from the win32 directory)
122 Also MSVC can be used with the "VSTools Developer Command Prompt":
123 > build-tcc.bat -c cl
125 or with a tcc (needs to be in a different directory)
126 > build-tcc.bat -c some-tcc-dir\tcc.exe
128 Also you can copy/install everything into another directory:
129 > build-tcc.bat -i <dir>
131 * You can also bootstrap a native tcc Windows toolchain with cygwin.
132 https://www.cygwin.com/
134 Install Base, gcc, make
135 Launch Cygwin Terminal
137 or to force 32bit executables (including 64bit backend)
139 or to force 64bit executables (including 32bit backend)
144 - On the object file level, currently TCC supports only the ELF format,
145 not COFF as used by MinGW and MSVC. It is not possible to exchange
146 object files or libraries between TCC and these compilers.
148 However libraries for TCC from objects by TCC can be made using
149 tcc -ar lib.a files.o ,,,
151 - No leading underscore is generated in the ELF symbols.
153 Documentation and License:
154 --------------------------
155 TCC is distributed under the GNU Lesser General Public License. (See
156 COPYING file or http://www.gnu.org/licenses/lgpl-2.1.html)
158 TinyCC homepage is at:
160 http://fabrice.bellard.free.fr/tcc/
163 WinAPI Help and 3rd-party tools:
164 --------------------------------
165 The Windows API documentation (Win95) in a single .hlp file is
166 available on the lcc-win32 site as "win32hlp.exe" or from other
167 locations as "win32hlp_big.zip".
169 A nice RAD tool to create windows resources (dialog boxes etc.) is
170 "ResEd", available at the RadASM website.