Fix another corner case with C/asm symtable
[tinycc.git] / win32 / tcc-win32.txt
blob751a8e0745979ab2cf0789af4117fe87f7bd578f
2     TinyCC
3     ======
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.
12     
14     Set the system PATH:
15     --------------------
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
18     system PATH.
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).
27     Examples:
28     ---------
29     Open a console window (DOS box) and 'cd' to the examples directory.
31     For the 'Fibonacci' example type:
33         tcc fib.c
35     For the 'Hello Windows' GUI example type:
37         tcc hello_win.c
39     For the 'Hello DLL' example type
41         tcc -shared dll.c
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
53     - Compiling with TCC:
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.
78     Header Files:
79     -------------
80     The system header files (except _mingw.h) are from the MinGW
81     distribution:
83         http://www.mingw.org/
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.
90     Resource Files:
91     ---------------
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
99     Tiny Libmaker:
100     --------------
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
110         http://www.mingw.org
111         http://www.mingw-w64.org
112         http://www.msys2.org
114       Untar the TCC archive and type in the MSYS shell:
115         ./configure [--prefix installpath]
116         make
117         make install
119       The default install location is c:\Program Files\tcc
121       Cygwin can be used too with its mingw cross-compiler installed:
122         ./configure --cross-prefix=i686-w64-mingw32-
123         (the prefix may vary)
125     * Alternatively you can compile TCC with just GCC from MinGW using
126         > build-tcc.bat (from the win32 directory)
128       Also MSVC can be used with the "VSTools Developer Command Prompt":
129         > build-tcc.bat -c cl
131       or with an existing tcc (needs to be in a different directory)
132         > build-tcc.bat -c some-tcc-dir\tcc.exe
134       Also you can copy/install everything into another directory:
135         > build-tcc.bat -i <dir>
137     Limitations:
138     ------------
139     - On the object file level, currently TCC supports only the ELF format,
140       not COFF as used by MinGW and MSVC.  It is not possible to exchange
141       object files or libraries between TCC and these compilers.
143       However libraries for TCC from objects by TCC can be made using
144         tcc -ar lib.a files.o ,,,
146     - No leading underscore is generated in the ELF symbols.
148     Documentation and License:
149     --------------------------
150     TCC is distributed under the GNU Lesser General Public License. (See
151     COPYING file or http://www.gnu.org/licenses/lgpl-2.1.html)
153     TinyCC homepage is at:
155         http://fabrice.bellard.free.fr/tcc/
158     WinAPI Help and 3rd-party tools:
159     --------------------------------
160     The Windows API documentation (Win95) in a single .hlp file is
161     available on the lcc-win32 site as "win32hlp.exe" or from other
162     locations as "win32hlp_big.zip".
164     A nice RAD tool to create windows resources (dialog boxes etc.) is
165     "ResEd", available at the RadASM website.
168     --- grischka