<?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[Dynamic Link Library (DLL) - Problem]]></title><description><![CDATA[<p>Hi!</p>
<p>ich eigne mir gerade DLL programmierung an, mittels der programmiersprache C++.<br />
irgendwie klappt das noch nicht so ganz. eventuell weis jemand warum. ich poste mal den EXE code und den DLL code.</p>
<p>EXE</p>
<pre><code class="language-cpp">#include &quot;windows.h&quot;

typedef void (*Function1Proc)(char *Msg, int ID);

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
    HMODULE MyLib; 
	Function1Proc runDLLFunction1 = NULL;

	MyLib = LoadLibrary(&quot;hm.dll&quot;);

    if(MyLib == NULL)
	{ 
        MessageBox(NULL,&quot;DLL nicht gefunden!&quot;,&quot;Haupt Programm&quot;,16); 
        return 1; 
    } 

    runDLLFunction1 = (Function1Proc)GetProcAddress(MyLib, &quot;_Function1&quot;);

    if(runDLLFunction1 == NULL)
	{ 
        MessageBox(NULL,&quot;DLL-Funktion nicht gefunden!&quot;,&quot;Haupt Programm&quot;,16); 
        return 2; 
    }

    runDLLFunction1(&quot;Hallo DLL Funktion. Hier sind wie erwartet deine zwei parameter&quot;,1); 
    FreeLibrary(MyLib); 

	return 0;
}
</code></pre>
<p>DLL</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
//..........................................................................
#define DLL_Export __declspec(dllexport)
//..........................................................................
DLL_Export void Function1(char *Msg, int ID)
{
	MessageBox(NULL,Msg,&quot;Function1&quot;,48);
}
//..........................................................................
DLL_Export void Function2(char *Msg, int ID)
{
	MessageBox(NULL,Msg,&quot;Function2&quot;,48);
}
//..........................................................................
DLL_Export void Function3(char *Msg, int ID)
{
	MessageBox(NULL,Msg,&quot;Function3&quot;,48);
}
//..........................................................................
DLL_Export void Function4(char *Msg, int ID)
{
	MessageBox(NULL,Msg,&quot;Function4&quot;,48);
}
//..........................................................................
DLL_Export void Function5(char *Msg, int ID)
{
	MessageBox(NULL,Msg,&quot;Function5&quot;,48);
}
//..........................................................................
BOOL WINAPI DllMain(HINSTANCE hDllInst, DWORD fdwReason, LPVOID lpvReserved) 
{ 
	switch (fdwReason)
	{ 
		case DLL_PROCESS_ATTACH: 
		break; 

		case DLL_PROCESS_DETACH: 
        break; 

		case DLL_THREAD_ATTACH: 
        break; 

		case DLL_THREAD_DETACH: 
        break; 
    } 
    return TRUE; 
} 
//..........................................................................
</code></pre>
<p>Wenn ich nun die exe datei starte kommt die messagebox<br />
&quot;DLL-Funktion nicht gefunden!&quot; <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/77135/dynamic-link-library-dll-problem</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 16:00:57 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/77135.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 17 Jun 2004 19:58:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Dynamic Link Library (DLL) - Problem on Thu, 17 Jun 2004 19:58:57 GMT]]></title><description><![CDATA[<p>Hi!</p>
<p>ich eigne mir gerade DLL programmierung an, mittels der programmiersprache C++.<br />
irgendwie klappt das noch nicht so ganz. eventuell weis jemand warum. ich poste mal den EXE code und den DLL code.</p>
<p>EXE</p>
<pre><code class="language-cpp">#include &quot;windows.h&quot;

typedef void (*Function1Proc)(char *Msg, int ID);

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
    HMODULE MyLib; 
	Function1Proc runDLLFunction1 = NULL;

	MyLib = LoadLibrary(&quot;hm.dll&quot;);

    if(MyLib == NULL)
	{ 
        MessageBox(NULL,&quot;DLL nicht gefunden!&quot;,&quot;Haupt Programm&quot;,16); 
        return 1; 
    } 

    runDLLFunction1 = (Function1Proc)GetProcAddress(MyLib, &quot;_Function1&quot;);

    if(runDLLFunction1 == NULL)
	{ 
        MessageBox(NULL,&quot;DLL-Funktion nicht gefunden!&quot;,&quot;Haupt Programm&quot;,16); 
        return 2; 
    }

    runDLLFunction1(&quot;Hallo DLL Funktion. Hier sind wie erwartet deine zwei parameter&quot;,1); 
    FreeLibrary(MyLib); 

	return 0;
}
</code></pre>
<p>DLL</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
//..........................................................................
#define DLL_Export __declspec(dllexport)
//..........................................................................
DLL_Export void Function1(char *Msg, int ID)
{
	MessageBox(NULL,Msg,&quot;Function1&quot;,48);
}
//..........................................................................
DLL_Export void Function2(char *Msg, int ID)
{
	MessageBox(NULL,Msg,&quot;Function2&quot;,48);
}
//..........................................................................
DLL_Export void Function3(char *Msg, int ID)
{
	MessageBox(NULL,Msg,&quot;Function3&quot;,48);
}
//..........................................................................
DLL_Export void Function4(char *Msg, int ID)
{
	MessageBox(NULL,Msg,&quot;Function4&quot;,48);
}
//..........................................................................
DLL_Export void Function5(char *Msg, int ID)
{
	MessageBox(NULL,Msg,&quot;Function5&quot;,48);
}
//..........................................................................
BOOL WINAPI DllMain(HINSTANCE hDllInst, DWORD fdwReason, LPVOID lpvReserved) 
{ 
	switch (fdwReason)
	{ 
		case DLL_PROCESS_ATTACH: 
		break; 

		case DLL_PROCESS_DETACH: 
        break; 

		case DLL_THREAD_ATTACH: 
        break; 

		case DLL_THREAD_DETACH: 
        break; 
    } 
    return TRUE; 
} 
//..........................................................................
</code></pre>
<p>Wenn ich nun die exe datei starte kommt die messagebox<br />
&quot;DLL-Funktion nicht gefunden!&quot; <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/542743</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/542743</guid><dc:creator><![CDATA[gandora]]></dc:creator><pubDate>Thu, 17 Jun 2004 19:58:57 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamic Link Library (DLL) - Problem on Thu, 17 Jun 2004 21:05:27 GMT]]></title><description><![CDATA[<p>Guckst du hier: <a href="http://forum.c-plusplus.net/viewtopic.php?t=60061" rel="nofollow">http://forum.c-plusplus.net/viewtopic.php?t=60061</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/542782</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/542782</guid><dc:creator><![CDATA[D*niel *chumann]]></dc:creator><pubDate>Thu, 17 Jun 2004 21:05:27 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamic Link Library (DLL) - Problem on Thu, 17 Jun 2004 21:07:28 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">typedef void (*Function1Proc)(char *Msg, int ID);
</code></pre>
<p>muss</p>
<pre><code class="language-cpp">typedef void (WINAPI* Function1Proc)(char *Msg, int ID);
</code></pre>
<p>heissen.</p>
<p>Mfg.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/542787</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/542787</guid><dc:creator><![CDATA[Tolga]]></dc:creator><pubDate>Thu, 17 Jun 2004 21:07:28 GMT</pubDate></item><item><title><![CDATA[Reply to Dynamic Link Library (DLL) - Problem on Thu, 17 Jun 2004 22:02:19 GMT]]></title><description><![CDATA[<p>hallo daniel.<br />
danke für den tipp. irgendwie heisst die exportierte funktion nähmlich<br />
?Function1@@YAXPADH@Z</p>
<p>wenn ich das so nutze, geht es. hm</p>
]]></description><link>https://www.c-plusplus.net/forum/post/542841</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/542841</guid><dc:creator><![CDATA[gandora]]></dc:creator><pubDate>Thu, 17 Jun 2004 22:02:19 GMT</pubDate></item></channel></rss>