Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5943457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:23:54+00:00 2026-05-22T16:23:54+00:00

I have an executable in linux – exe This executable has some functions in

  • 0

I have an executable in linux – exe

This executable has some functions in it, that are used throughout the code:

  • sendMsg
  • debugPrint

I then want to dynamically load a .so that provides extra functionality to my executable.

In this shared library I include the headers for sendMsg and debugPrint.

I load this shared library with dlopen() and create an API with dlsym().

However, at dlopen() I use RTLD_NOW to resolve all symbols at load time.

It fails stating that it cannot find sendMsg symbol.

This symbol must be in the executable as the sendMsg.c is compiled in there.

However, my executable is stripped by the make process. As such, it would make sense that dlopen cannot find the symbol.

How can i solve this situation?

  • I could build the shared functions into a static library and link that static library into both exe and the .so. This would increase code size 🙁
  • I could remove the stripping of the exe so the symbols can be found
  • Do some compile time linking magic that I don’t know about so the .so knows where the symbols are in exe
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T16:23:54+00:00Added an answer on May 22, 2026 at 4:23 pm

    man ld:

       -E
       --export-dynamic
       --no-export-dynamic
           When  creating  a  dynamically  linked  executable, using the -E option or the --export-dynamic option causes the linker to add all symbols to the dynamic symbol table.  The
           dynamic symbol table is the set of symbols which are visible from dynamic objects at run time.
    
           If you do not use either of these options (or use the --no-export-dynamic option to restore the default behavior), the dynamic symbol table will normally contain only  those
           symbols which are referenced by some dynamic object mentioned in the link.
    
           If  you  use "dlopen" to load a dynamic object which needs to refer back to the symbols defined by the program, rather than some other dynamic object, then you will probably
           need to use this option when linking the program itself.
    
           You can also use the dynamic list to control what symbols should be added to  the  dynamic  symbol  table  if  the  output  format  supports  it.   See  the  description  of
           --dynamic-list.
    
           Note  that  this  option  is  specific  to  ELF  targeted  ports.   PE  targets  support  a  similar function to export all symbols from a DLL or EXE; see the description of
           --export-all-symbols below.
    

    You can also pass the -rdynamic option to gcc/g++ (as noted int the comment). Depending on how you setup your make script, this will be convenient

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a bit confusing. I have a linux executable that I do not
I have an executable that is started by a windows service, this program will
I have an executable that defaults to 32-bit. It doesn't have source code and
I want to have an executable file that will call some other programs. The
Assume I have an executable called 'exe' which spawns a child process. This child
I have an executable that I need to run some tests on in C++
I have an executable file (program.exe) That is virus infected. Is there any possible
I have a small program that mmaps potentially dangerous executable code (with PROT_EXEC), calls
I have a C code executable for Linux. For release, I can have two
Possible Duplicate: Is a Linux executable compatible with OS X? I have some c++

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.