- 所有 tcc 文件/内容/宏改名为 pcc (tcc.c->pcc.c, tccelf.c->pccelf.c, libtcc.c->libpcc.c 等) - 支持架构: i386, x86_64, ARM, ARM64, RISC-V, C67 - 支持格式: PE, ELF, Mach-O, COFF - 完整预处理、代码生成、链接器、调试信息 - 构建成功: pcc.exe (x86_64 Windows) - 功能测试通过: 递归/结构体/浮点/switch/循环 - 自编译测试通过: pcc 可以编译自身
193 行
5.8 KiB
Plaintext
193 行
5.8 KiB
Plaintext
|
|
PazeCC
|
|
======
|
|
|
|
This file contains specific information for usage of PazeCC
|
|
under MS-Windows. See pcc-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 "pcc", please add the directory containing pcc.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 (pcc.exe, libpcc.dll).
|
|
|
|
|
|
Examples:
|
|
---------
|
|
Open a console window (DOS box) and 'cd' to the examples directory.
|
|
|
|
For the 'Fibonacci' example type:
|
|
|
|
pcc fib.c
|
|
|
|
For the 'Hello Windows' GUI example type:
|
|
|
|
pcc hello_win.c
|
|
|
|
For the 'Hello DLL' example type
|
|
|
|
pcc -shared dll.c
|
|
pcc -impdef dll.dll (optional)
|
|
pcc hello_dll.c dll.def
|
|
|
|
|
|
Using libpcc as JIT compiler in your program
|
|
--------------------------------------------
|
|
Check out the 'libpcc_test' example:
|
|
|
|
- Running it from source:
|
|
pcc -I libpcc libpcc/libpcc.def -run examples/libpcc_test.c
|
|
|
|
- Compiling with PCC:
|
|
pcc examples/libpcc_test.c -I libpcc libpcc/libpcc.def
|
|
|
|
- Compiling with MinGW:
|
|
gcc examples/libpcc_test.c -I libpcc libpcc.dll -o libpcc_test.exe
|
|
|
|
- Compiling with MSVC:
|
|
lib /def:libpcc\libpcc.def /out:libpcc.lib
|
|
cl /MD examples/libpcc_test.c -I libpcc libpcc.lib
|
|
|
|
|
|
Import Definition Files:
|
|
------------------------
|
|
To link with Windows system DLLs, PCC 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
|
|
|
|
pcc -impdef [-v] opengl32.dll [-o opengl32.def]
|
|
|
|
Put opengl32.def into the pcc/lib directory. Specify -lopengl32 at
|
|
the PCC 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 "pcc/include/winapi" directory.
|
|
|
|
If the latest mingw headers don't play nice with the PazeCC headers,
|
|
there's also PazeCC-specific win32 headers package which contains
|
|
an "include" dir. Files in that dir are additional to the built-in
|
|
include files. At the time of writing there are few files in that
|
|
package which also exist as built-in headers:
|
|
|
|
unistd.h
|
|
winapi/qos.h
|
|
winapi/winnls.h
|
|
winapi/ws2ipdef.h
|
|
winapi/ws2tcpip.h
|
|
winapi/windows.h
|
|
winapi/winsock2.h
|
|
|
|
With the exception of winapi/winsock2.h, these should overwrite the
|
|
built-in headers (unistd.h and winapi/windows.h are enhanced in that
|
|
package, winapi/winsock2.h is older than the built-in file - and with
|
|
less definitions, and the rest are identical).
|
|
|
|
The latest package at the time of writing is winapi-full-for-0.9.27.zip
|
|
which works well also with PazeCC 0.9.28rc, and is available at:
|
|
|
|
http://download.savannah.nongnu.org/releases/tinycc/
|
|
|
|
|
|
Resource Files:
|
|
---------------
|
|
PCC can link windows resources in coff format as generated by MinGW's
|
|
windres.exe. For example:
|
|
|
|
windres -O coff app.rc -o appres.o
|
|
pcc 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:
|
|
|
|
pcc -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 PCC archive and type in the MSYS shell:
|
|
./configure [--prefix installpath]
|
|
make
|
|
make install
|
|
|
|
The default install location is c:\Program Files\pcc
|
|
|
|
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 PCC with just GCC from MinGW using
|
|
> build-pcc.bat (from the win32 directory)
|
|
|
|
Also MSVC can be used with the "VSTools Developer Command Prompt":
|
|
> build-pcc.bat -c cl
|
|
|
|
or with an existing pcc (needs to be in a different directory)
|
|
> build-pcc.bat -c some-pcc-dir\pcc.exe
|
|
|
|
Also you can copy/install everything into another directory:
|
|
> build-pcc.bat -i <dir>
|
|
|
|
Limitations:
|
|
------------
|
|
- On the object file level, currently PCC supports only the ELF format,
|
|
not COFF as used by MinGW and MSVC. It is not possible to exchange
|
|
object files or libraries between PCC and these compilers.
|
|
|
|
However libraries for PCC from objects by PCC can be made using
|
|
pcc -ar lib.a files.o ,,,
|
|
|
|
- No leading underscore is generated in the ELF symbols.
|
|
|
|
Documentation and License:
|
|
--------------------------
|
|
PCC is distributed under the GNU Lesser General Public License. (See
|
|
COPYING file or http://www.gnu.org/licenses/lgpl-2.1.html)
|
|
|
|
PazeCC homepage is at:
|
|
|
|
http://fabrice.bellard.free.fr/pcc/
|
|
|
|
|
|
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
|