function pointer - ambiguous symbol error
<p>MyClass is a singleton class (There will only ever be one of these in my whole program).</p>

<p>What I want to do is follows.</p>

<ol>
<li>Add data to my class using AddData, get a function pointer returned that I can then pass to 'another' function in a dll.</li>
<li>Then this 'other' function calls my call back function</li>
</ol>

<p>My class is like so.</p>

<pre><code>typedef void (*DataReceivedCallback)(int, int);  

class MyClass
{
    MyClass();
    ~MyClass();

    void AddData(int sourceId, DataReceivedCallback &amp;callback);
    static void MyCallBackFunction(int var1, int var2);
};

void MyClass::AddData(int sourceId, DataReceivedCallback &amp;callback)
{
    callback = &amp;MyCallBackFunction;

}
void MyClass::MyCallBackFunction(int var1, int var2 )
{
    //do something blah blah
}
</code></pre>

<p>I can then do:</p>

<pre><code>int main()
{
     DataReceivedCallback callback;
     MyClass-&gt;GetInstance()-&gt;AddData(1, callback);
     callback(1,100);
}
</code></pre>

<p>When I step through this I see that I do actually step into the callback MyCallBackFunction which is what I want :)</p>

<p>What I then want to do now is pass this 'callback' defined in main to a dll function that will call back into my callback function.</p>

<p>I have the code for the dll so I want to modify one if its functions so that it accepts my callback function parameter.</p>

<p>I am doing this in the dll function signature:</p>

<pre><code>void * someDllFunction( int var1, int var2, DataReceivedCallback&amp; callback)
{
   callback(2, 200);
}
</code></pre>

<p>But I get the error:
<strong>error C2872: 'DataReceivedCallback' : ambiguous symbol</strong></p>

<p>How can I solve this?
Does this have to do with only being allowed to use c-style parameters across dll boundaries??</p>
