Closed
Description
I have a function to create a singleton of a class, but the linker complains about some missing functions.
lrcpp::Frontend& lrcpp::Frontend::getInstance() {
static uint8_t fsmMemory[sizeof(CoreFsm)] alignas(CoreFsm);
static Frontend singleton(fsmMemory);
return singleton;
}
$ make clean && make
CLEAN /home/leiradel/Develop/circle/sample/libretro
CPP frontend/Main.o
CPP frontend/Kernel.o
CPP frontend/Frontend.o
CPP frontend/Fifo.o
CC core/main.o
CPP lrcpp/src/Components.o
CPP lrcpp/src/Core.o
CPP lrcpp/src/CoreFsm.o
CPP lrcpp/src/Frontend.o
LD kernel8.elf
aarch64-linux-gnu-ld: lrcpp/src/Frontend.o: in function `lrcpp::Frontend::getInstance()':
/home/leiradel/Develop/circle/sample/libretro/lrcpp/src/Frontend.cpp:65: undefined reference to `__cxa_guard_acquire'
aarch64-linux-gnu-ld: /home/leiradel/Develop/circle/sample/libretro/lrcpp/src/Frontend.cpp:65: undefined reference to `__cxa_guard_release'
make: *** [../../Rules.mk:155: kernel8.img] Error 1
These functions prevent the static variables from being initialized more than once should two threads try to get the singleton at the same time. I'm using an #idef
to special case it when building with Circle, but I think it would be better if Circle supported it directly.
Metadata
Metadata
Assignees
Labels
No labels