Page 1 of 1

Compiling C++ code with PsyQ/Programmer's Tool SDK

Posted: June 10th, 2018, 1:49 am
by LameGuy64
The SDevTC toolchain included in the PsyQ or Programmer's Tool SDK actually supports C++. You just need to pass it to ccpsx like you would with a C file.

Code: Select all

ccpsx -Xo0x80010000 -Wall -O2 main.cpp -o main.cpe
The compiler programs are actually cc1psx and cc1plpsx. ccpsx is merely a front-end.

You may want to make sure that there's a cplus_include_path variable in your PSYQ.INI/SN.INI file that points to your SDK's include directory if you experience compiler errors regarding missing header files. You can also specify it as an environment variable but be aware that it may get in the way of your existing C++ toolchains if you have one installed so I recommend just editing the INI file to avoid a conflict.

I haven't really tested which C++ features are supported but it does support class objects and you can define variables anywhere on your code unlike in C where you can only define variables before any procedure. I haven't checked what kind of allocator the compiler uses when dynamically creating and deleting class objects yet and I have a feeling it might be using the buggy malloc implementation in the BIOS.

Obviously, the C++ implementation is pre C++98 so you may want to be aware of that.

Re: Compiling C++ code with PsyQ/Programmer's Tool SDK

Posted: June 10th, 2018, 2:12 am
by Sblorgz
Simply check which features were supported in GCC 2.8.1 and you will know what PSQY-Q's toolchain supports, since it's a modified GCC with custom linkable objects and overlay support through linker maps.