First let me start with the code:
main.cpp: (compiles as main.c)
Code: Select all
#include <pspsdk.h>
#include <pspkernel.h>
#define VERS 0
#define REVS 55
PSP_MODULE_INFO("HLEAudio", 0x1006, VERS, REVS);
int module_start (SceSize argc, void* argp)
{
return 0;
}
int module_stop (SceSize args, void *argp)
{
return 0;
}
Code: Select all
TARGET = HLEAudio
OBJS = main.o
CFLAGS = -O2 -G0 -DNDEBUG -Wall -MD
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
INCDIR = ../../../SDK/include
LIBDIR = ../../../SDK/lib
BUILD_PRX = 1
PRX_EXPORTS = exports.exp
USE_KERNEL_LIBC=1
USE_KERNEL_LIBS=1
LDFLAGS = -mno-crt0 -nostartfiles
LIBS =
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
all: $(FINAL_TARGET)
cp $(FINAL_TARGET) "../../.."
Code: Select all
# Define the exports for the prx
PSP_BEGIN_EXPORTS
# These four lines are mandatory (although you can add other functions like module_stop)
# syslib is a psynonym for the single mandatory export.
PSP_EXPORT_START(syslib, 0, 0x8000)
PSP_EXPORT_FUNC_HASH(module_start)
PSP_EXPORT_VAR_HASH(module_info)s
PSP_EXPORT_FUNC(module_stop)
PSP_EXPORT_END
# This is where we export our functions to be called by the main app
PSP_EXPORT_START(HLEAudio, 0, 0x4001)
PSP_EXPORT_END
PSP_END_EXPORTS
First when compiling as is if I rebuild it I get an error linking:
Code: Select all
1>C:/pspsdk/bin/rm -f HLEAudio.prx HLEAudio.elf exports.o main.o PARAM.SFO EBOOT.PBP
1>psp-gcc -IC:/pspsdk/psp/sdk/include/libc -I../../../SDK/include -I. -IC:/pspsdk/psp/sdk/include -O2 -G0 -DNDEBUG -Wall -MD -D_PSP_FW_VERSION=150 -c -o main.o main.c
1>psp-build-exports -b exports.exp > exports.c
1>psp-gcc -IC:/pspsdk/psp/sdk/include/libc -I../../../SDK/include -I. -IC:/pspsdk/psp/sdk/include -O2 -G0 -DNDEBUG -Wall -MD -D_PSP_FW_VERSION=150 -c -o exports.o exports.c
1>psp-gcc -IC:/pspsdk/psp/sdk/include/libc -I../../../SDK/include -I. -IC:/pspsdk/psp/sdk/include -O2 -G0 -DNDEBUG -Wall -MD -D_PSP_FW_VERSION=150 -L../../../SDK/lib -L. -LC:/pspsdk/psp/sdk/lib -specs=C:/pspsdk/psp/sdk/lib/prxspecs -Wl,-q,-TC:/pspsdk/psp/sdk/lib/linkfile.prx -mno-crt0 -nostartfiles main.o exports.o -lpspdebug -lpspdisplay_driver -lpspctrl_driver -lpspsdk -lpspkernel -o HLEAudio.elf
1>psp-fixup-imports HLEAudio.elf
1>Error, no .lib.stub section found
1>C:\pspsdk\bin\make: *** [HLEAudio.elf] Error 1
1>rm exports.c
1>Build log was saved at "file://f:\PSPDev\DaedalusX64 Curent Code\DX64-Abstracted\Source\SysPSP\AudioPRX\obj\Debug\AudioPRXBuildLog.htm"
1>AudioPRX - 0 error(s), 0 warning(s)
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
If I just rename main.c to main.cpp and that is the only change I can't get it to compile at all and get this:
Code: Select all
1>psp-build-exports -b exports.exp > exports.c
1>psp-gcc -IC:/pspsdk/psp/sdk/include/libc -I../../../SDK/include -I. -IC:/pspsdk/psp/sdk/include -O2 -G0 -DNDEBUG -Wall -MD -D_PSP_FW_VERSION=150 -c -o exports.o exports.c
1>psp-gcc -IC:/pspsdk/psp/sdk/include/libc -I../../../SDK/include -I. -IC:/pspsdk/psp/sdk/include -O2 -G0 -DNDEBUG -Wall -MD -D_PSP_FW_VERSION=150 -L../../../SDK/lib -L. -LC:/pspsdk/psp/sdk/lib -specs=C:/pspsdk/psp/sdk/lib/prxspecs -Wl,-q,-TC:/pspsdk/psp/sdk/lib/linkfile.prx -mno-crt0 -nostartfiles main.o exports.o -lpspdebug -lpspdisplay_driver -lpspctrl_driver -lpspsdk -lpspkernel -o HLEAudio.elf
1>c:/pspsdk/bin/../lib/gcc/psp/4.3.3/../../../../psp/bin/ld.exe: warning: cannot find entry symbol module_start; defaulting to 0000000000000000
1>exports.o:(.rodata.sceResident+0xc): undefined reference to `module_start'
1>exports.o:(.rodata.sceResident+0x10): undefined reference to `module_stop'
1>collect2: ld returned 1 exit status
1>C:\pspsdk\bin\make: *** [HLEAudio.elf] Error 1
1>rm exports.c
1>Build log was saved at "file://f:\PSPDev\DaedalusX64 Curent Code\DX64-Abstracted\Source\SysPSP\AudioPRX\obj\Debug\AudioPRXBuildLog.htm"
1>AudioPRX - 0 error(s), 1 warning(s)
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========