[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] Problems linking lib that uses the constructor __attribute



m0n0 wrote:
which does not work, because of doubly defined references.... I have to
adjust the sdl.pc to make it work..., the line than looks like:
--whole-archive -lnsfb --no-whole-archive -lsdl -lgem -lldg -lgem

Please use only --whole-archive as last resort :-(

I have found a linker option which seems to be exactly what you need. The option -u can force a reference to an external symbol which may be defined inside a library. You have to: - use the form -Wl,-u on the GCC command line to pass that option down to the linker
- put that option *before* the library containing the definition
- prepend the function name with an _ as the linker deals with assembler symbols

Thus, try the following instead of your quote above:
-Wl,-u,_sdl_register_frontend -lnsfb -lsdl -lgem -lldg -lgem

Everything should be good and optimal.

--
Vincent Rivière