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

  • Home
  • SEARCH
  • 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 8220589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:34:31+00:00 2026-06-07T13:34:31+00:00

I am loading a function from a .SO ‘plugin’ file in my code. The

  • 0

I am loading a function from a .SO ‘plugin’ file in my code. The plugin will define 3 very specific functions, the full API for each function is defined ahead of time (the point is allow different instances of the same program to modify their behavior via the use of a different plugin. Due to the amount of it’s use, need for speed, and my general laziness I decided to use a static function pointer which can store the plugin functions rather then passing the function pointer around various objects.

It’s possible for a plugin not to exist, in which case I want to run what is essentially a ‘no-op’ function in place of the function that would have been read form the plugin. For general safety I want to ensure that the static function pointers point to my no-op functions.

For whatever reason I can’t seem to do this. If I try to define the no-op funciton in the .h file and assign my function pointer to it I get all kinds of errors for defining a function in a .h. If I try to declare only the prototype of the method in the .h and assign the function pointer to the prototype I get an undeclared funciton exception, even if the function is defined in a .cpp file.

I know I can easily assign the funciton pointer to a no-op in my main() function. But is there a way to do this so that the .H file gaurentees that the pointer defaults to my no-op function even if I (or someone later) don’t properly assign it in my main() method?

  • 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-06-07T13:34:34+00:00Added an answer on June 7, 2026 at 1:34 pm

    Header (say, PluginInterface.h):

    extern void (*my_plugin_function_ptr)(...);
    

    Source (say, PluginInterface.cpp):

    #include "PluginInterface.h"
    
    static void default_plugin_function(...) {/* does nothing */};
    
    void (*my_plugin_function_ptr)(...)=&default_plugin_function;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've a program that implements a plugin system by dynamically loading a function from
I am using following code to show a spinning wheel: $(#loading) .hide() .ajaxStart(function(){ $(this).show();
I am loading some template files into my application using require.js like so: define(function(require)
I am trying to call a javascript function from loaded local html file in
I stumbled upon the function .globalEval() from browsing the jQuery source. There is very
I have write a code for loading html dynamically through jQuery $(table).eq(5).html('<table><tr><td>some data</td></tr></table><script language=JavaScript>function
I have some javascript applying changes to some elements and a function loading more
This is related to a question I've asked previously: Calling Javascript function after loading
After loading a PHP template (using jQuery's load function), this simple script won't make
I have a simple function that shows loading spinner while fetching data (usually takes

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.