Search code examples
c++symbolsintrospectionstripdlsym

How to detect at runtime whether symbols are stripped?


In my C++ program, how can I detect programmatically at runtime whether symbols have been stripped via the 'strip' gnu development tool on Linux?

I'd like a function definition which returns true if stripped, otherwise false.

Would using dlsym() on "main()" work to detect this reliably?


Solution

  • I know the file command can tell the difference, so you could possibly look at its source to see what mechanism it uses.