jeudi 19 juillet 2018

Function pointer usage with hierarchical control: xtern/namespace C++

Below is a sample usage from an older and newer version of a software stack. How would the function usage and access differ with the hierarchical structuring of the two pieces of code below:

namespace std
{
    typedef void (*function)();
    extern "C" function fn_ptr(function) throw();
}

And

extern "C++" 
{
  namespace std
  {
      typedef void (*function)();
      function fn_ptr(function) throw();
  }
}

The first one is easy but I wish to access fn_ptr from both C and C++ based files in the 2nd example. Note that it is extern "C++" and there isn't much to find about extern "C++" usage on Stackoverflow or Google.

Aucun commentaire:

Enregistrer un commentaire