<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[callback funktion frage:]]></title><description><![CDATA[<p>Hallo Leute ich hab ne Klasse mit einer callback funktion:</p>
<pre><code class="language-cpp">class CPr2_Connection
{
	public:
	static int CALLBACK OnRecord(void *p);
	//static DWORD WINAPI ThreadEntry (void *pArg);

	CPr2_Connection(); 
	void SendData(){

		printf(&quot;%i&quot;, CPr2_Connection::OnRecord(&quot;TEST&quot;));
	}
	~CPr2_Connection(void);
};
</code></pre>
<p>wenn ich nun &quot;SendDAta&quot; aufrufe, so die OnRecord Funktion aufgerufen werden.. (was auch klappt).</p>
<p>Wenn aber nun die OnRecord funktion nicht implementiert ist.. komm der fehler</p>
<p>PR2Connection error LNK2019: unresolved external symbol &quot;public: static int</p>
<pre><code>__stdcall CPr2_Connection::OnRecord(void *)&quot; (?OnRecord@CPr2_Connection@@SGHPAX@Z) referenced in function &quot;public: void __thiscall CPr2_Connection::SendData(void)&quot; (?SendData@CPr2_Connection@@QAEXXZ)
</code></pre>
<p>was mir auch klar ist.. er kann den funktionrumpf nich finden..</p>
<p>aber wie kann ich es machen, das er die funktion einfach nich ausführt wenn sie nicht implementiert ist?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/213576/callback-funktion-frage</link><generator>RSS for Node</generator><lastBuildDate>Wed, 14 Oct 2026 04:40:54 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/213576.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 19 May 2008 13:05:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to callback funktion frage: on Mon, 19 May 2008 13:05:22 GMT]]></title><description><![CDATA[<p>Hallo Leute ich hab ne Klasse mit einer callback funktion:</p>
<pre><code class="language-cpp">class CPr2_Connection
{
	public:
	static int CALLBACK OnRecord(void *p);
	//static DWORD WINAPI ThreadEntry (void *pArg);

	CPr2_Connection(); 
	void SendData(){

		printf(&quot;%i&quot;, CPr2_Connection::OnRecord(&quot;TEST&quot;));
	}
	~CPr2_Connection(void);
};
</code></pre>
<p>wenn ich nun &quot;SendDAta&quot; aufrufe, so die OnRecord Funktion aufgerufen werden.. (was auch klappt).</p>
<p>Wenn aber nun die OnRecord funktion nicht implementiert ist.. komm der fehler</p>
<p>PR2Connection error LNK2019: unresolved external symbol &quot;public: static int</p>
<pre><code>__stdcall CPr2_Connection::OnRecord(void *)&quot; (?OnRecord@CPr2_Connection@@SGHPAX@Z) referenced in function &quot;public: void __thiscall CPr2_Connection::SendData(void)&quot; (?SendData@CPr2_Connection@@QAEXXZ)
</code></pre>
<p>was mir auch klar ist.. er kann den funktionrumpf nich finden..</p>
<p>aber wie kann ich es machen, das er die funktion einfach nich ausführt wenn sie nicht implementiert ist?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1512261</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1512261</guid><dc:creator><![CDATA[BorisDieKlinge]]></dc:creator><pubDate>Mon, 19 May 2008 13:05:22 GMT</pubDate></item><item><title><![CDATA[Reply to callback funktion frage: on Mon, 19 May 2008 13:09:32 GMT]]></title><description><![CDATA[<blockquote>
<p>aber wie kann ich es machen, das er die funktion einfach nich ausführt wenn sie nicht implementiert ist?</p>
</blockquote>
<p>Keine Angst, dafür sorgt der Kompiler und der Linker: Wenn die Methode nicht implementiert ist und Du sie aufrufen willst, sagts dir der Kompiler/Linker.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1512267</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1512267</guid><dc:creator><![CDATA[simon.gysi]]></dc:creator><pubDate>Mon, 19 May 2008 13:09:32 GMT</pubDate></item><item><title><![CDATA[Reply to callback funktion frage: on Mon, 19 May 2008 13:20:50 GMT]]></title><description><![CDATA[<p>Das geht so nicht, wie du willst. Wenn du deine funktion definierst so wie du, musst du sie auch implmentieren, wenn du sie irgendwo im code benutzt.</p>
<p>DAs ist übrigens auch keine callback-funktion. Als callback-funktion wäre ein Funktionszeiger das richtige (is aber veraltet, lieber funktoren benutzen etc.). diesen kannst du dann auf NULL testen, und somit gucken, ob du eine callback-funktion aufrufen sollst, oder nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1512277</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1512277</guid><dc:creator><![CDATA[Maxi]]></dc:creator><pubDate>Mon, 19 May 2008 13:20:50 GMT</pubDate></item><item><title><![CDATA[Reply to callback funktion frage: on Mon, 19 May 2008 13:48:02 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/2470">@Maxi</a>: hmm ok, kannst du mir evlt. ein beispiel machen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1512292</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1512292</guid><dc:creator><![CDATA[BorisDieKlinge]]></dc:creator><pubDate>Mon, 19 May 2008 13:48:02 GMT</pubDate></item><item><title><![CDATA[Reply to callback funktion frage: on Mon, 19 May 2008 14:01:30 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;iostream&gt;
using namespace std;

class CPr2_Connection 
{
	public:
		typedef int (*MyCallback)(void* p);

		MyCallback callback;

		CPr2_Connection(MyCallback cb)
		: callback(cb)
		{
		}

		void SendData()
		{
			if(callback!=0)
				cout &lt;&lt; callback((void*)&quot;TEST&quot;);
		}
};

int Test(void* p)
{
	cout &lt;&lt; &quot;Callback&quot;;

	return 123;
}

int main()
{

	CPr2_Connection s1(0);
	s1.SendData();

	CPr2_Connection s2(&amp;::Test);
	s2.SendData();
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1512302</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1512302</guid><dc:creator><![CDATA[ihoernchen]]></dc:creator><pubDate>Mon, 19 May 2008 14:01:30 GMT</pubDate></item><item><title><![CDATA[Reply to callback funktion frage: on Mon, 19 May 2008 14:04:36 GMT]]></title><description><![CDATA[<p>wow, genau das hab ich gesaucht, ich danke dir;) grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1512303</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1512303</guid><dc:creator><![CDATA[BorisDieKlinge]]></dc:creator><pubDate>Mon, 19 May 2008 14:04:36 GMT</pubDate></item></channel></rss>