<?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[Dll&#x27;s]]></title><description><![CDATA[<p>hey</p>
<p>Ich habe eine Anwendung geschrieben, die DLL's dynamisch laden soll. Sie lädt die DLL's, jedoch nicht die in ihr enthaltenen Funktionen:</p>
<pre><code class="language-cpp">#undef UNICODE
#include &lt;windows.h&gt;

int WINAPI DllMain(HINSTANCE handle, unsigned long reason, void* reserved)
{
	return 1;
}

__declspec(dllexport) void test(void)
{
	Beep(1000, 100);
}
</code></pre>
<p>Dll wurde ins system32 verzeichnis kopiert.</p>
<p>Hier meine &quot;Lade&quot;-Anwendung:</p>
<pre><code class="language-cpp">#undef UNICODE
#include &lt;windows.h&gt;
#include &lt;iostream&gt;
using namespace std;

typedef void (CALLBACK* DllFunction)(void);

int main(void)
{
	HMODULE dll;
	DllFunction initialize;

	dll = LoadLibrary(&quot;TempPointInterface.dll&quot;);

	if(!dll)
	{
		cout &lt;&lt; &quot;kann dll nicht laden&quot; &lt;&lt; endl;
	}
	else
	{
		initialize = (DllFunction)(GetProcAddress(dll, &quot;test&quot;)); 

		if(!initialize)
		{
			cout &lt;&lt; &quot;kann Funktion aus dll nicht laden&quot; &lt;&lt; endl;
		}
		else
		{
			initialize();
		}
	}

	FreeLibrary(dll);

	char a;
	cin &gt;&gt; a;

	return 0;
}
</code></pre>
<p>die zweite Fehlermeldung (kann Funktion aus dll nicht laden) wird merkwürdigerweise ausgegeben. Weiß jemand wieso?</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/205277/dll-s</link><generator>RSS for Node</generator><lastBuildDate>Thu, 08 Oct 2026 22:13:51 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/205277.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 12 Feb 2008 14:29:46 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Dll&#x27;s on Tue, 12 Feb 2008 14:29:46 GMT]]></title><description><![CDATA[<p>hey</p>
<p>Ich habe eine Anwendung geschrieben, die DLL's dynamisch laden soll. Sie lädt die DLL's, jedoch nicht die in ihr enthaltenen Funktionen:</p>
<pre><code class="language-cpp">#undef UNICODE
#include &lt;windows.h&gt;

int WINAPI DllMain(HINSTANCE handle, unsigned long reason, void* reserved)
{
	return 1;
}

__declspec(dllexport) void test(void)
{
	Beep(1000, 100);
}
</code></pre>
<p>Dll wurde ins system32 verzeichnis kopiert.</p>
<p>Hier meine &quot;Lade&quot;-Anwendung:</p>
<pre><code class="language-cpp">#undef UNICODE
#include &lt;windows.h&gt;
#include &lt;iostream&gt;
using namespace std;

typedef void (CALLBACK* DllFunction)(void);

int main(void)
{
	HMODULE dll;
	DllFunction initialize;

	dll = LoadLibrary(&quot;TempPointInterface.dll&quot;);

	if(!dll)
	{
		cout &lt;&lt; &quot;kann dll nicht laden&quot; &lt;&lt; endl;
	}
	else
	{
		initialize = (DllFunction)(GetProcAddress(dll, &quot;test&quot;)); 

		if(!initialize)
		{
			cout &lt;&lt; &quot;kann Funktion aus dll nicht laden&quot; &lt;&lt; endl;
		}
		else
		{
			initialize();
		}
	}

	FreeLibrary(dll);

	char a;
	cin &gt;&gt; a;

	return 0;
}
</code></pre>
<p>die zweite Fehlermeldung (kann Funktion aus dll nicht laden) wird merkwürdigerweise ausgegeben. Weiß jemand wieso?</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1454459</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1454459</guid><dc:creator><![CDATA[kaschimaster]]></dc:creator><pubDate>Tue, 12 Feb 2008 14:29:46 GMT</pubDate></item><item><title><![CDATA[Reply to Dll&#x27;s on Tue, 12 Feb 2008 14:36:44 GMT]]></title><description><![CDATA[<p>wenn du die dll als c++ kompilierst, musst du deine exportfunktion wegen dem name-mangeling (oder so ähnlich heißt das) mit extern &quot;C&quot; deklarieren. Dann gehen zwar keine Überladungen, aber du kannst sie wenigstens laden:</p>
<pre><code class="language-cpp">extern &quot;C&quot; __declspec(dllexport) void test();

int DllMain(...) { ... }

__declspec(dllexport) void test() { beep(); }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1454463</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1454463</guid><dc:creator><![CDATA[Maxi]]></dc:creator><pubDate>Tue, 12 Feb 2008 14:36:44 GMT</pubDate></item><item><title><![CDATA[Reply to Dll&#x27;s on Tue, 12 Feb 2008 14:39:57 GMT]]></title><description><![CDATA[<p>Benutze den Dependecy Walker um zu sehen, was wirklich exportiert wird.<br />
Simon</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1454466</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1454466</guid><dc:creator><![CDATA[simon.gysi]]></dc:creator><pubDate>Tue, 12 Feb 2008 14:39:57 GMT</pubDate></item><item><title><![CDATA[Reply to Dll&#x27;s on Tue, 12 Feb 2008 14:40:28 GMT]]></title><description><![CDATA[<p>Vielen Dank!!!<br />
Und nochmals vielen dank für die schnelle Antwort, da muss ich heute wohl keine Überstunden machen^^</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1454467</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1454467</guid><dc:creator><![CDATA[kaschimaster]]></dc:creator><pubDate>Tue, 12 Feb 2008 14:40:28 GMT</pubDate></item><item><title><![CDATA[Reply to Dll&#x27;s on Tue, 12 Feb 2008 14:44:08 GMT]]></title><description><![CDATA[<p>Hmm vllt. öffnest du mal mit Dependency Walker deine DLL und stellst dann etwas fest. Was ist mit dem Namen deiner Funktion los?!</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;iostream&gt;

typedef void (*fnFoo)();

int main()
{
    // open dynamic linking library file handle
    ::HMODULE hDLL (::LoadLibraryA(&quot;TempPointInterface.dll&quot;));

    // could open dll?
    if (hDLL == NULL)
    {
        std::cerr &lt;&lt; &quot;\&quot;TempPointerInterface.dll\&quot; could not be loaded!&quot; &lt;&lt; std::endl; 
        return 1;
    }

    // try to load function
    fnFoo foo(reinterpret_cast&lt;fnFoo&gt;(::GetProcAddressA(hDLL, &quot;foo&quot;)));

    // function could be loaded?
    if (foo == NULL)
    {
        std::cerr &lt;&lt; &quot;Funktion \&quot;foo\&quot; konnte nicht gefunden werden!&quot; &lt;&lt; std::endl;
        return 1;
    }

    // call loaded function
    foo();

    // free dynamic linking library
    ::FreeLibrary(hDLL);

    // await user input
    std::cin.get();
}
</code></pre>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;iostream&gt;

int WINAPI DllMain(HINSTANCE, DWORD, LPVOID)
{ return 1; }

// #if TEMPPOINTER_EXPORTS
#define TEMPPOINTER_API __declspec(dllexport)
// #else
// #define TEMPPOINTER_API __declspec(dllimport)
// #endif 

extern &quot;C&quot; 
{
    TEMPPOINTER_API void foo()
    {
        std::clog &lt;&lt; &quot;foo() function called!&quot; &lt;&lt; std::endl;
    }
}
</code></pre>
<p>sollte es dir möglich machen, die Funktion korrekt zu laden <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1454474</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1454474</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Tue, 12 Feb 2008 14:44:08 GMT</pubDate></item></channel></rss>