<?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 Einbinden]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe ein Beispiel gefunden, wie man eine DLL in seinen ausführbaren Quellcode bekommt.<br />
(<a href="http://www.coding-board.de/board/attachment.php?s=eaddf78edc3fc6e8d08c0010f35500f6&amp;attachmentid=1&amp;d=1022568216" rel="nofollow">http://www.coding-board.de/board/attachment.php?s=eaddf78edc3fc6e8d08c0010f35500f6&amp;attachmentid=1&amp;d=1022568216)</a>)<br />
Allerdings gibt es dort eine *.lib. Wie bekomme ich die da heraus?<br />
(Natürlich soll das Programm trotzdem noch laufen... - wer gerade an löschen gedacht hat)</p>
<p>Mein Rechner ist ein Vista - System, und ich arbeite mit Visual C++ 6.0 (gezwungendermaßen)</p>
<p>MfG<br />
cluehr</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/233430/dll-einbinden</link><generator>RSS for Node</generator><lastBuildDate>Thu, 24 Sep 2026 13:57:03 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/233430.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 04 Feb 2009 16:05:58 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to DLL Einbinden on Wed, 04 Feb 2009 16:05:58 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe ein Beispiel gefunden, wie man eine DLL in seinen ausführbaren Quellcode bekommt.<br />
(<a href="http://www.coding-board.de/board/attachment.php?s=eaddf78edc3fc6e8d08c0010f35500f6&amp;attachmentid=1&amp;d=1022568216" rel="nofollow">http://www.coding-board.de/board/attachment.php?s=eaddf78edc3fc6e8d08c0010f35500f6&amp;attachmentid=1&amp;d=1022568216)</a>)<br />
Allerdings gibt es dort eine *.lib. Wie bekomme ich die da heraus?<br />
(Natürlich soll das Programm trotzdem noch laufen... - wer gerade an löschen gedacht hat)</p>
<p>Mein Rechner ist ein Vista - System, und ich arbeite mit Visual C++ 6.0 (gezwungendermaßen)</p>
<p>MfG<br />
cluehr</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1657957</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1657957</guid><dc:creator><![CDATA[cluehre]]></dc:creator><pubDate>Wed, 04 Feb 2009 16:05:58 GMT</pubDate></item><item><title><![CDATA[Reply to DLL Einbinden on Wed, 04 Feb 2009 16:13:59 GMT]]></title><description><![CDATA[<p>Die lib wird über den linker ganz normal gebunden.<br />
Edit:<br />
Visual Studio erstellt die automatisch wenn man über ein .def-file die Funktionen exportiert oder per __declspec(dllexport), das gilt aber nur, wenn man selbst eine DLL schreibt. Ist mir nicht ganz klar, was du grade willst :). Zur DLL linken oder eine basteln.<br />
rya.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1657963</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1657963</guid><dc:creator><![CDATA[[[global:former_user]]]]></dc:creator><pubDate>Wed, 04 Feb 2009 16:13:59 GMT</pubDate></item><item><title><![CDATA[Reply to DLL Einbinden on Wed, 04 Feb 2009 18:11:44 GMT]]></title><description><![CDATA[<p>Hallo rya,</p>
<blockquote>
<p>Visual Studio erstellt die automatisch wenn man über ein .def-file die Funktionen exportiert oder per __declspec(dllexport), das gilt aber nur, wenn man selbst eine DLL schreibt.</p>
</blockquote>
<p>habe es gerade mal getestet; das läuft soweit, erst einmal thx dafür</p>
<p>Wird die *.lib im Projektordner eigendlich automatisch erkannt? (habe keinen Eintrag &quot;dll.lib&quot; in irgendwelchen Projekteinstellungen gefunden)</p>
<p>Soweit so gut...<br />
Aber kann man nicht auch Funktionen einer DLL ohne einer zusätzlichen *.lib benutzen?<br />
Das war mit</p>
<blockquote>
<p>Allerdings gibt es dort eine *.lib. Wie bekomme ich die da heraus?</p>
</blockquote>
<p>gemeint (sry, war ein wenig unpräziese)</p>
<p>MfG<br />
cluehre</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1658046</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1658046</guid><dc:creator><![CDATA[cluehre]]></dc:creator><pubDate>Wed, 04 Feb 2009 18:11:44 GMT</pubDate></item><item><title><![CDATA[Reply to DLL Einbinden on Wed, 04 Feb 2009 18:17:19 GMT]]></title><description><![CDATA[<p>cluehre schrieb:</p>
<blockquote>
<p>Soweit so gut...<br />
Aber kann man nicht auch Funktionen einer DLL ohne einer zusätzlichen *.lib benutzen?</p>
</blockquote>
<p>Ja kann man. Dann muß man die dll dynamische laden. Siehe dazu<br />
LoadLibrary, GetProcAddress etc.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1658053</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1658053</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Wed, 04 Feb 2009 18:17:19 GMT</pubDate></item><item><title><![CDATA[Reply to DLL Einbinden on Thu, 05 Feb 2009 11:45:32 GMT]]></title><description><![CDATA[<p>Hallo Braunstein,</p>
<blockquote>
<p>Siehe dazu LoadLibrary, GetProcAddress etc.</p>
</blockquote>
<p>habe dazu folgenden Code geschrieben</p>
<p>Erstellen der DLL</p>
<pre><code>#include &lt;windows.h&gt;

#include &quot;stdafx.h&quot;

extern&quot;C&quot; _declspec(dllexport) int add (int a, int b);
BOOL APIENTRY DllMain( HANDLE hModule, 
                       DWORD  ul_reason_for_call, 
                       LPVOID lpReserved
					 )
{
    return TRUE;
}

int add (int a, int b)
{
	return a + b;
}
</code></pre>
<p>Nutzen der DLL (speziell die add - Fnktion)</p>
<pre><code>#include &quot;stdafx.h&quot;
#include &lt;stdio.h&gt;
#include &lt;windows.h&gt;

typedef int (CALLBACK* DLLFUNC)(int, int);

int __declspec (dllimport) add (int a, int b);

DLLFUNC DllFunc1;

void main(int argc, char* argv[])
{
	int a=1;
	int b=2;

	HMODULE hMod=LoadLibrary(&quot;dll&quot;);
	if (hMod==NULL){
		printf(&quot;Keine DLL gefunden&quot;);
	}

	DllFunc1 = (DLLFUNC)GetProcAddress(hMod, &quot;add&quot;);

	if (!DllFunc1){
		printf(&quot;Keine \&quot;add\&quot; - Funktion gefunden&quot;);

	}else{ 
	printf(&quot;Aufruf&quot;);
		a=DllFunc1(a,b);
	}
	FreeLibrary (hMod);

}
</code></pre>
<p>Das Problem ist das die add - Funktion nicht gefunden wird.(das printf in Zeile26 wird ausgeführt) Sieht evtl. jemand den Grund?</p>
<p>MfG<br />
cluehre</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1658413</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1658413</guid><dc:creator><![CDATA[cluehre]]></dc:creator><pubDate>Thu, 05 Feb 2009 11:45:32 GMT</pubDate></item><item><title><![CDATA[Reply to DLL Einbinden on Thu, 05 Feb 2009 12:06:40 GMT]]></title><description><![CDATA[<p>Richtig wäre:</p>
<blockquote>
<p>extern &quot;C&quot;<br />
int add (int a, int b)<br />
{<br />
return a + b;<br />
}</p>
</blockquote>
<p>rya.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1658426</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1658426</guid><dc:creator><![CDATA[scorcher24@arbyte]]></dc:creator><pubDate>Thu, 05 Feb 2009 12:06:40 GMT</pubDate></item><item><title><![CDATA[Reply to DLL Einbinden on Wed, 11 Feb 2009 20:12:30 GMT]]></title><description><![CDATA[<p>moin zusammen,</p>
<p>thx scorer habes es zum laufen bekommen.</p>
<p>Nun habe ich die Problematik ne ganze Klasse in ne DLL bekommen zu müssen.</p>
<p>Stumpf</p>
<pre><code>extern&quot;C&quot; _declspec(dllexport)
</code></pre>
<p>geht leider nicht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":-("
      alt="😞"
    /></p>
<p>Muss man da was besonders beachten?<br />
Ich denke dieses</p>
<pre><code>BOOL APIENTRY DllMain( HANDLE hModule,
     DWORD  ul_reason_for_call,LPVOID lpReserved)
{return TRUE;}
</code></pre>
<p>muss durch irgendetwas ersetzt werden.</p>
<p>Nochwas:<br />
- Die Klasse muss dynamisch aufrufbar sein.<br />
- Kompilerkompatibilitäten sind kein Problem.<br />
- Benutze Visual C++ 6.0</p>
<p>Thx für alles was euch dazu einfällt<br />
MfG cluehre</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1662121</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1662121</guid><dc:creator><![CDATA[cluehre]]></dc:creator><pubDate>Wed, 11 Feb 2009 20:12:30 GMT</pubDate></item><item><title><![CDATA[Reply to DLL Einbinden on Wed, 11 Feb 2009 20:45:52 GMT]]></title><description><![CDATA[<p>Output fetched:</p>
<p><a href="http://letmegooglethatforyou.com/?q=c%2B%2B+klasse+in+dll" rel="nofollow">http://letmegooglethatforyou.com/?q=c%2B%2B+klasse+in+dll</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1662138</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1662138</guid><dc:creator><![CDATA[brain.exe]]></dc:creator><pubDate>Wed, 11 Feb 2009 20:45:52 GMT</pubDate></item><item><title><![CDATA[Reply to DLL Einbinden on Wed, 11 Feb 2009 22:40:36 GMT]]></title><description><![CDATA[<p>ohmg... nette animation die du da rausgekramt hast...die kannte ich noch nicht^^</p>
<p>wenn noch jemand was hat, was weiterhelfen könnte bin ich sehr dankbar</p>
<p>MfG cluehre</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1662189</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1662189</guid><dc:creator><![CDATA[cluehre]]></dc:creator><pubDate>Wed, 11 Feb 2009 22:40:36 GMT</pubDate></item><item><title><![CDATA[Reply to DLL Einbinden on Thu, 12 Feb 2009 06:36:31 GMT]]></title><description><![CDATA[<p>Naja, das beste ist, du legst im allgemeinen Header von deiner DLL erstmal ein Makro an ( ich hoffe du hast so nen Uberheader, wenn nicht mach dir einen :p )</p>
<pre><code class="language-cpp">#if defined(MYPROJECT_EXPORTS) &amp;&amp; defined(WIN32) // &lt;- das kannst du nennen wie du es willst, muss aber bei der DLL in den Präprozessor
#define MY_EXPORT __declspec(dllexport)
#elif defined(WIN32)
#define MY_EXPORT _declspec(dllimport)
#endif /* EXPORT */
[cpp]
Das macht man, damit automatisch entschieden wird, imported oder exported wird. 
Dann sollte das so gehen: 
[cpp]
extern &quot;C&quot; MY_EXPORT int foobar(int a, int b);
</code></pre>
<p>Alternativ kannst du ohne _declspec aus einer .def-Datei exportieren, die du beim linken angibst:</p>
<pre><code>EXPORT
    add @1
</code></pre>
<p>EXPORT muss oben hin, das heisst, dass exportiert wird.<br />
add @1 heisst, dass add als erste funktion exportiert wird. In dem Fall reicht die Deklaration von add mit:</p>
<pre><code class="language-cpp">int add(int a, int b);
</code></pre>
<p>Und ja, da kann man dann auch Klassen exportieren. Man darf es aber auf keinen Fall in C-Code dann verwenden.<br />
HTH<br />
rya.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1662218</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1662218</guid><dc:creator><![CDATA[scorcher24@arbyte]]></dc:creator><pubDate>Thu, 12 Feb 2009 06:36:31 GMT</pubDate></item><item><title><![CDATA[Reply to DLL Einbinden on Thu, 12 Feb 2009 16:38:38 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>thx @scorcher24 hast mir sehr weitergeholfen.<br />
warscheinlich habe ich das soweit hinbekommen; der Compiler ist zumindest einverstanden.</p>
<p>Das Problem ist das ich die Klasse nicht mehr aus der DLL bekomme; die Klasse also in meinem Hauptprogramm nicht verwenden kann.<br />
Mit GetProgAddress get es ja nicht. Gibt es eine äquivalente Funktion/Strategie für Klassen?<br />
Oder geht sowas überhapt nicht, bzw. ist schlecht umsetzbar.</p>
<p>Hat jemand nen Strategieänderung? Bin für alles offen.</p>
<p>*sry wegen der ganzen dummen fragen, bin ein newbie was die Thematik angeht*</p>
<p>MfG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1662669</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1662669</guid><dc:creator><![CDATA[cluehre]]></dc:creator><pubDate>Thu, 12 Feb 2009 16:38:38 GMT</pubDate></item><item><title><![CDATA[Reply to DLL Einbinden on Fri, 13 Feb 2009 05:10:29 GMT]]></title><description><![CDATA[<p>Wie ich bereits schrieb: Es ist egal ob du Klassen oder Werte zurückgibst. Wenn du eine Funktion aus einer DLL manuell lädst, ist nur der Name wichtig. Du musst halt wissen, was diese Funktion zurückgibt.<br />
<a href="http://www.google.de/search?hl=de&amp;ei=tgCVSarxBM-n-gbJm7yOCQ&amp;sa=X&amp;oi=spell&amp;resnum=1&amp;ct=result&amp;cd=1&amp;q=how+to+export+from+a+dll+on+windows&amp;spell=1" rel="nofollow">http://www.google.de/search?hl=de&amp;ei=tgCVSarxBM-n-gbJm7yOCQ&amp;sa=X&amp;oi=spell&amp;resnum=1&amp;ct=result&amp;cd=1&amp;q=how+to+export+from+a+dll+on+windows&amp;spell=1</a><br />
rya.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1662905</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1662905</guid><dc:creator><![CDATA[[[global:former_user]]]]></dc:creator><pubDate>Fri, 13 Feb 2009 05:10:29 GMT</pubDate></item></channel></rss>