title: Unresolved external symbol, with home-made delegate
body: <p>I have a function <code>Foo</code> which takes a 2-parameter function as a parameter:</p>
  
  <pre><code>void Foo(void (*fcn)(int, int*));
  </code></pre>
  
  <p>However, the type of function which I want to pass in (<code>func</code>) only takes 1 parameter<sup>*</sup>.</p>
  
  <pre><code>typedef void (__stdcall *FuncCallBack)(int a);
  
  void Caller(FuncCallBack func) {
     Foo(????);
  }
  </code></pre>
  
  <p>In C#, I would do something like:</p>
  
  <pre><code>Foo((a,b) -&gt; func(a));
  </code></pre>
  
  <p>I'm trying to do something similar with a delegate class (having worked out that I can't have a pointer to a bound member function, I've switched to static):</p>
  
  <pre><code>class Delegate {
  private:
   static FuncCallBack _Callback;
  public
   Delegate(FuncCallBack);
   static void Callback(int, int*);
  }
  
  Delegate::Delegate(FuncCallback callback) { _Callback = callback; }
  
  void Delegate::Callback(int a, int *b) { _Callback(a); }
  </code></pre>
  
  <p>Which I use like so:</p>
  
  <pre><code>void Caller(FuncCallBack func) {
     Delegate d = Delegate(func);
     Foo(&amp;(d.Callback));
  }
  </code></pre>
  
  <p>This is currently giving me a linker error: <code>unresolved external symbol "private: static void (__stdcall* Delegate::_Callback)(int)" (?_Callback@Delegate@@0P6GXHHPAN0@ZA)</code></p>
  
  <ul>
  <li>Question 1: What could be causing this linker error?</li>
  <li>Question 2: Is there a better way to do this?</li>
  </ul>
  
  <p><sup>*The function typedef includes <code>__stdcall</code> because it is passed in from (and will be calling back to) C#)</sup></p>