Coder Social home page Coder Social logo

phoenixthrush / tiny-c-compiler Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 0.0 488 KB

The Tiny C Compiler (a.k.a. TCC, tCc, or TinyCC) is an x86, X86-64 and ARM processor C compiler initially written by Fabrice Bellard.

Home Page: https://bellard.org/tcc/

License: GNU Lesser General Public License v2.1

C 96.32% C++ 3.68%
bellard compiler tcc tinycc

tiny-c-compiler's Introduction

    TinyCC
    ======

    This file contains specific information for usage of TinyCC
    under MS-Windows.  See tcc-doc.html to have all the features.


    Installation from the binary ZIP package:
    -----------------------------------------
    Unzip the package to a directory of your choice.
    

    Set the system PATH:
    --------------------
    To be able to invoke the compiler from everywhere on your computer by
    just typing "tcc", please add the directory containing tcc.exe to your
    system PATH.


    Include and library search paths
    --------------------------------
    On windows,  the standard "include" and "lib" directories are searched
    relatively from the location of the executables (tcc.exe, libtcc.dll).


    Examples:
    ---------
    Open a console window (DOS box) and 'cd' to the examples directory.

    For the 'Fibonacci' example type:

	tcc fib.c

    For the 'Hello Windows' GUI example type:

	tcc hello_win.c

    For the 'Hello DLL' example type

	tcc -shared dll.c
	tcc -impdef dll.dll (optional)
        tcc hello_dll.c dll.def


    Using libtcc as JIT compiler in your program
    --------------------------------------------
    Check out the 'libtcc_test' example:

    - Running it from source:
        tcc -I libtcc libtcc/libtcc.def -run examples/libtcc_test.c

    - Compiling with TCC:
        tcc examples/libtcc_test.c -I libtcc libtcc/libtcc.def

    - Compiling with MinGW:
        gcc examples/libtcc_test.c -I libtcc libtcc.dll -o libtcc_test.exe

    - Compiling with MSVC:
        lib /def:libtcc\libtcc.def /out:libtcc.lib
        cl /MD examples/libtcc_test.c -I libtcc libtcc.lib


    Import Definition Files:
    ------------------------
    To link with Windows system DLLs, TCC uses import definition
    files (.def) instead of libraries.

    The now built-in 'tiny_impdef' program may be used to make
    additional .def files for any DLL. For example

        tcc -impdef [-v] opengl32.dll [-o opengl32.def]

    Put opengl32.def into the tcc/lib directory.  Specify -lopengl32 at
    the TCC commandline to link a program that uses opengl32.dll.


    Header Files:
    -------------
    The system header files (except _mingw.h) are from the MinGW
    distribution:

	http://www.mingw.org/

    From the windows headers, only a minimal set is included.  If you need
    more,  get MinGW's "w32api" package.  Extract the files from "include"
    into your "tcc/include/winapi" directory.


    Resource Files:
    ---------------
    TCC can link windows resources in coff format as generated by MinGW's
    windres.exe.  For example:

        windres -O coff app.rc -o appres.o
        tcc app.c appres.o -o app.exe


    Tiny Libmaker:
    --------------
    The now built-in tiny_libmaker tool by Timovj Lahde can be used as
    'ar' replacement to make a library from several object files:

	tcc -ar [rcsv] library objectfiles ...


    Compilation from source:
    ------------------------
    * You can use the MinGW and MSYS tools available at
        http://www.mingw.org
        http://www.mingw-w64.org
        http://www.msys2.org

      Untar the TCC archive and type in the MSYS shell:
        ./configure [--prefix installpath]
        make
        make install

      The default install location is c:\Program Files\tcc

      Cygwin can be used too with its mingw cross-compiler installed:
        ./configure --cross-prefix=i686-w64-mingw32-
        (the prefix may vary)

    * Alternatively you can compile TCC with just GCC from MinGW using
        > build-tcc.bat (from the win32 directory)

      Also MSVC can be used with the "VSTools Developer Command Prompt":
        > build-tcc.bat -c cl

      or with an existing tcc (needs to be in a different directory)
        > build-tcc.bat -c some-tcc-dir\tcc.exe

      Also you can copy/install everything into another directory:
        > build-tcc.bat -i <dir>

    Limitations:
    ------------
    - On the object file level, currently TCC supports only the ELF format,
      not COFF as used by MinGW and MSVC.  It is not possible to exchange
      object files or libraries between TCC and these compilers.

      However libraries for TCC from objects by TCC can be made using
        tcc -ar lib.a files.o ,,,

    - No leading underscore is generated in the ELF symbols.

    Documentation and License:
    --------------------------
    TCC is distributed under the GNU Lesser General Public License. (See
    COPYING file or http://www.gnu.org/licenses/lgpl-2.1.html)

    TinyCC homepage is at:

	http://fabrice.bellard.free.fr/tcc/


    WinAPI Help and 3rd-party tools:
    --------------------------------
    The Windows API documentation (Win95) in a single .hlp file is
    available on the lcc-win32 site as "win32hlp.exe" or from other
    locations as "win32hlp_big.zip".

    A nice RAD tool to create windows resources (dialog boxes etc.) is
    "ResEd", available at the RadASM website.


    --- grischka

tiny-c-compiler's People

Contributors

phoenixthrush avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.