title: Pass function to dynamic link library
body: <p>I need to pass function inside dynamic link library project. In this project I have two functions: </p>
  
  <pre><code>HRESULT solve_serial(solver::TSolver_Setup &amp;setup, solver::TSolver_Progress &amp;progress) {
    start(setup.max_generations, setup.population_size, setup.problem_size, setup.lower_bound, setup.upper_bound);
  }
  
  void start(size_t problem_size, size_t max_generation, size_t population_size, const double* lower_bound, const double* upper_bound)
  {
      while (t &lt;= MaxGeneration)
      {
          for (i = 0; i &lt; n; i++)
          {
              // ---------- HERE I NEED TO USE PASSED FUNCTION -------------
              f[i] = function(ffa[i]);  // obtain fitness of solution
              I[i] = f[i];                        // initialize attractiveness
          }
      }
  }
  </code></pre>
  
  <p><code>solve-serial</code> is called from external program and it will obtain <code>&amp;setup</code> with function I need to pass inside funtion <code>start</code> where I will used it.</p>
  
  <p>This is how <code>solver::TSolver_Setup</code> looks like:</p>
  
  <pre><code>using TObjective_Function = double(IfaceCalling*)(const void *data, const double *solution);
  
  struct TSolver_Setup {
      const TObjective_Function objective;
  };
  </code></pre>
  
  <p>How can I pass the funtion? I cannot change <code>solver::TSolver_Setup</code> but I can change <code>start</code> (or variables inside same file).</p>