And regarding the segfault, am I doing something wrong?
You can turn on core dumping (ulimit -c unlimited
), open core dump in gdb
and ask gdb
to show backtrace - bt
, I suppose you see something like:
b2::make_world
b2::make_world
b2::make_world
b2::make_world
because of you call no_mangle
function, so I suppose linker can not distinguish b2::f
and a::f
.