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 6657851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:49:17+00:00 2026-05-26T01:49:17+00:00

In my scenario I want a plugin, which is a shared object loaded in

  • 0

In my scenario I want a plugin, which is a shared object loaded in runtime, to access symbols from the “host application” so I can add any functionality to my application.

I have tried but have not found any way to do this and I have no clue on whether this is possible or not. So, can I do this somehow or is there any alternative that applications that use plugins use?

I am on Fedora 15, Linux 2.6.4. However, I hope the solution will be cross-platform.

  • 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-26T01:49:18+00:00Added an answer on May 26, 2026 at 1:49 am

    There are three main approaches:

    1. Pass a structure of function pointers to the DLL from the application, giving access to whatever symbols you want to share. This is the most portable method, but is kind of a pain to create all the function pointers. Something like:

      // In shared header
      struct app_vtable {
        void (*appFoo)();
      };
      
      // In plugin:
      const app_vtable *vt;
      void set_vtable(const app_vtable *vt_) {
        vt = vt_;
      }
      
      void bar() {
        vt->appFoo();
      }
      
      // In application:
      void foo();
      const app_vtable vt = { foo };
      
      void loadplugin() {
        void *plugin = dlopen("plugin.so", RTLD_LAZY);
        void (*pset_vtable)(const app_vtable *) = dlsym(plugin, "set_vtable");
      
        pset_vtable(&vt);
      
        void (*pbar)() = dlsym(plugin, "bar");
        pbar();
      }
      
    2. Move your application into a library, and have the executable simply link in this library and call an entry point in it. Then your plugins can link the same library and access its symbols easily. This is also quite portable, but can result in some performance loss due to the need to use position-independent code in your main app library (although you may be able to get away with a fixed mapping in this case, depending on your architecture).

    3. On Linux only (and possible other ELF platforms) you can use -rdynamic to export symbols from the application executable directly. However this isn’t very portable to other platforms – in particular, these is no equivalent to this on Windows.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Scenario I have a windows forms application. I want to use two different WCF
My scenario should be simple... the type I want to convert FROM is ALWAYS
The scenario: I’m building a website, which will not Host the images in its
So, here is the scenario: I want to create a installer which would just
A simple scenario: I want to delete a pagelayout that is out-dated from our
I have an application in which i want to provide the people who write
I have the following scenario I want to add methods dynamically to a controller.
Scenario I want to parse a large CSV file and inserts data into the
The scenario is I want to get the users who has less than 2
We have a scenario where we want to display a list of items and

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.