<?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[Probleme mit dynamischem DLL-Einbinden]]></title><description><![CDATA[<p>Hi. Ich hab mal versucht nach dem Beispiel in der FAQ eine DLL dynamisch einzubinden. Folgender Code dazu:</p>
<pre><code class="language-cpp">//.h-Datei:
class TDLLTest
{
private:
   typedef __int64 (DLLFUNCTION)(__int64);

   DLLFUNCTION   *pDllFunction;

public:
    TDLLTest();
    void CallDllFunction(__int64 iTest1);
};

//.cpp-Datei:
//---------------------------------------------------------------------------
#include &lt;vcl\vcl.h&gt;
#pragma hdrstop

#include &quot;Test.h&quot;
//---------------------------------------------------------------------------
#pragma resource &quot;*.dfm&quot;
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
    TDLLTest DLLTest;
    DLLTest.CallDllFunction(StrToInt(Edit1-&gt;Text));
}
//---------------------------------------------------------------------------
TDLLTest::TDLLTest()
{
   HINSTANCE hInstance;

   hInstance = ::LoadLibrary(&quot;Test.dll&quot;);
   pDllFunction  = (DLLFUNCTION*)::GetProcAddress((HMODULE)hInstance, &quot;TestFunktion&quot;);
}

void TDLLTest::CallDllFunction(__int64 iTest1)
{
    __int64 iResult;

    if (pDllFunction)
        iResult = (*pDllFunction)(iTest1);

    Form1-&gt;Label1-&gt;Caption=IntToStr(iResult);
}
</code></pre>
<p>Jetzt krieg ich aber als Ergebnis der Funktion immer 1243836 raus, was ich als DLL-Name und Funktionsname eingebe is im Grunde vollkommen egal es kommt immer der gleiche Quark heraus. Die Funktion in der DLL funktioniert auf jeden Fall richtig. Kann mir jemand sagen was ich jetzt falsch gemacht hab?</p>
<p>Danke im Voraus. //&lt;&lt; Oh mann ob Voraus oder Vorraus is doch auch egal... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/89127/probleme-mit-dynamischem-dll-einbinden</link><generator>RSS for Node</generator><lastBuildDate>Sun, 05 Jul 2026 21:41:08 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/89127.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 16 Oct 2004 14:19:19 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Probleme mit dynamischem DLL-Einbinden on Sat, 16 Oct 2004 14:24:25 GMT]]></title><description><![CDATA[<p>Hi. Ich hab mal versucht nach dem Beispiel in der FAQ eine DLL dynamisch einzubinden. Folgender Code dazu:</p>
<pre><code class="language-cpp">//.h-Datei:
class TDLLTest
{
private:
   typedef __int64 (DLLFUNCTION)(__int64);

   DLLFUNCTION   *pDllFunction;

public:
    TDLLTest();
    void CallDllFunction(__int64 iTest1);
};

//.cpp-Datei:
//---------------------------------------------------------------------------
#include &lt;vcl\vcl.h&gt;
#pragma hdrstop

#include &quot;Test.h&quot;
//---------------------------------------------------------------------------
#pragma resource &quot;*.dfm&quot;
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
    TDLLTest DLLTest;
    DLLTest.CallDllFunction(StrToInt(Edit1-&gt;Text));
}
//---------------------------------------------------------------------------
TDLLTest::TDLLTest()
{
   HINSTANCE hInstance;

   hInstance = ::LoadLibrary(&quot;Test.dll&quot;);
   pDllFunction  = (DLLFUNCTION*)::GetProcAddress((HMODULE)hInstance, &quot;TestFunktion&quot;);
}

void TDLLTest::CallDllFunction(__int64 iTest1)
{
    __int64 iResult;

    if (pDllFunction)
        iResult = (*pDllFunction)(iTest1);

    Form1-&gt;Label1-&gt;Caption=IntToStr(iResult);
}
</code></pre>
<p>Jetzt krieg ich aber als Ergebnis der Funktion immer 1243836 raus, was ich als DLL-Name und Funktionsname eingebe is im Grunde vollkommen egal es kommt immer der gleiche Quark heraus. Die Funktion in der DLL funktioniert auf jeden Fall richtig. Kann mir jemand sagen was ich jetzt falsch gemacht hab?</p>
<p>Danke im Voraus. //&lt;&lt; Oh mann ob Voraus oder Vorraus is doch auch egal... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/630116</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/630116</guid><dc:creator><![CDATA[aaaabyx]]></dc:creator><pubDate>Sat, 16 Oct 2004 14:24:25 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit dynamischem DLL-Einbinden on Mon, 18 Oct 2004 13:00:24 GMT]]></title><description><![CDATA[<p>*schieb*</p>
]]></description><link>https://www.c-plusplus.net/forum/post/631561</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/631561</guid><dc:creator><![CDATA[aaaabyx]]></dc:creator><pubDate>Mon, 18 Oct 2004 13:00:24 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit dynamischem DLL-Einbinden on Mon, 18 Oct 2004 20:53:24 GMT]]></title><description><![CDATA[<p>wird doch wohl jemand wissen...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/632030</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/632030</guid><dc:creator><![CDATA[aaaabyx]]></dc:creator><pubDate>Mon, 18 Oct 2004 20:53:24 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit dynamischem DLL-Einbinden on Tue, 19 Oct 2004 03:46:07 GMT]]></title><description><![CDATA[<p>na ja, du prüfst auch nicht, ob du die dll richtig geladen hast:</p>
<pre><code class="language-cpp">HINSTANCE hInstance;

   hInstance = ::LoadLibrary(&quot;Test.dll&quot;);
   if (hInstance != 0) {
      pDllFunction  = (DLLFUNCTION*)::GetProcAddress((HMODULE)hInstance, &quot;TestFunktion&quot;);
   } else {
      ShowMessage(&quot;fehler beim laden der dll&quot;);
   }
</code></pre>
<p>versuch mal das.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/632102</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/632102</guid><dc:creator><![CDATA[Acidmrp]]></dc:creator><pubDate>Tue, 19 Oct 2004 03:46:07 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit dynamischem DLL-Einbinden on Tue, 19 Oct 2004 11:53:57 GMT]]></title><description><![CDATA[<p>Ich geh mal davon aus dass er sie nich lädt ich probiers gerade mal aus...</p>
<p>EDIT: Hm komisch das Laden der DLL klappt offensichtlich aber jetzt kommt auf einmal bei der Rechnung immer 0 heraus !? Was soll das denn jetzt!?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/632335</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/632335</guid><dc:creator><![CDATA[aaaabyx]]></dc:creator><pubDate>Tue, 19 Oct 2004 11:53:57 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit dynamischem DLL-Einbinden on Tue, 19 Oct 2004 13:18:21 GMT]]></title><description><![CDATA[<p>Hast Du auch mal auf meiner Seite geguckt, da habe ich das Thema mal etwas verständlicher (hoffentlich) zusammengestellt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/632430</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/632430</guid><dc:creator><![CDATA[F98]]></dc:creator><pubDate>Tue, 19 Oct 2004 13:18:21 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit dynamischem DLL-Einbinden on Tue, 19 Oct 2004 13:31:48 GMT]]></title><description><![CDATA[<p>1000 Dank F98!</p>
<p>War der Punkt mit dem Unterstrich vor der Funktion... Jetzt klappts!<br />
Super is auch die ganze Beschreibung da, muss man sagen die is übersichtlicher als in der FAQ.</p>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/632448</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/632448</guid><dc:creator><![CDATA[aaaabyx]]></dc:creator><pubDate>Tue, 19 Oct 2004 13:31:48 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit dynamischem DLL-Einbinden on Wed, 20 Oct 2004 06:10:07 GMT]]></title><description><![CDATA[<p>Vielen Dank für das Lob! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<p>In die &quot;Unterstrich&quot;-Falle bin ich auch schon getappt. Ich bin dabei bald durchgedreht. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/632939</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/632939</guid><dc:creator><![CDATA[F98]]></dc:creator><pubDate>Wed, 20 Oct 2004 06:10:07 GMT</pubDate></item></channel></rss>