<?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[LoadLibrary mit BDS2006]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich habe mal wieder ein kleines Problem.</p>
<p>Ich habe ein ursprünglich mit BCB 5 entwickeltes Programm, welches dynamisch einige Funktionen aus einer eigenen DLL lädt.</p>
<p>Kürzlich habe ich die DLL mit dem BDS2006 compiliert und konnte diese problemlos mit dem alten BCB 5 Programm weiterbenutzen.<br />
Nun bin ich dabei das Hauptprogramm zu überarbeiten.<br />
Der Aufruf der Funktionen aus der DLL erfolgt wie folgt:</p>
<pre><code class="language-cpp">typedef int Funktion(int);
Funktion *pFunktion;
//
...
//
__fastcall TForm1::TForm1(TComponent* Owner): TForm(Owner)
{
}
//
void __fastcall TForm1::ButtonClick(TObject *Sender)
{
HINSTANCE hDllInst;
try
  {
  hDllInst=LoadLibrary(&quot;dlldatei.dll&quot;);
  if (hDllInst!=NULL)
    {
    Edit1-&gt;Text=&quot;DLL&quot;;
    pFunktion=(Funktion*)::GetProcAddress((HMODULE)hDllInst, &quot;DllFunktion&quot;);                                                       
    (pFunktion)(5000);
    FreeLibrary(hDllInst);
    }
  else
    {
    Edit1-&gt;Text=&quot;NODLL&quot;;
    }
  }
//
...
//
}
</code></pre>
<p>Der Zugriff auf die DLL gelingt nicht. Das hDllInst ist nach dem LoadLibrary-Aufruf NULL.<br />
Ich habe den kompletten Code in ein neues Projekt kopiert und der Zugriff auf die DLL funktioniert ohne Änderungen am Programmcode.<br />
Die DLL-Datei befindet sich jeweils im gleichen Verzeichnis wie das Hauptprogramm und die DLL-Datei ist definitiv funktionsfähig. Sie arbeitet problemlos mit der BCB5 Version des Programmes. Der Zugriff auf die DLL erfolgt in dem Programm in der gleichen Weise abgesehen von den Hinweistexten im Edit1-Feld.</p>
<p>Mir fällt keine Debugmöglichkeit ein.<br />
Ich vermute irgendeine Projektoption verhindert den Zugriff auf die DLL.<br />
Aber die Suche danach ist wie die Suche nach der Nadel im Heuhaufen.</p>
<p>Hat jemand eine Idee. Vielleicht ist das Problem ja schon mal bei jemand anders aufgetreten.<br />
Achja, Update 2 ist installiert.</p>
<p>Vielen Dank</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/149754/loadlibrary-mit-bds2006</link><generator>RSS for Node</generator><lastBuildDate>Sat, 08 Aug 2026 07:36:42 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/149754.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 09 Jun 2006 01:34:01 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to LoadLibrary mit BDS2006 on Fri, 09 Jun 2006 01:34:01 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich habe mal wieder ein kleines Problem.</p>
<p>Ich habe ein ursprünglich mit BCB 5 entwickeltes Programm, welches dynamisch einige Funktionen aus einer eigenen DLL lädt.</p>
<p>Kürzlich habe ich die DLL mit dem BDS2006 compiliert und konnte diese problemlos mit dem alten BCB 5 Programm weiterbenutzen.<br />
Nun bin ich dabei das Hauptprogramm zu überarbeiten.<br />
Der Aufruf der Funktionen aus der DLL erfolgt wie folgt:</p>
<pre><code class="language-cpp">typedef int Funktion(int);
Funktion *pFunktion;
//
...
//
__fastcall TForm1::TForm1(TComponent* Owner): TForm(Owner)
{
}
//
void __fastcall TForm1::ButtonClick(TObject *Sender)
{
HINSTANCE hDllInst;
try
  {
  hDllInst=LoadLibrary(&quot;dlldatei.dll&quot;);
  if (hDllInst!=NULL)
    {
    Edit1-&gt;Text=&quot;DLL&quot;;
    pFunktion=(Funktion*)::GetProcAddress((HMODULE)hDllInst, &quot;DllFunktion&quot;);                                                       
    (pFunktion)(5000);
    FreeLibrary(hDllInst);
    }
  else
    {
    Edit1-&gt;Text=&quot;NODLL&quot;;
    }
  }
//
...
//
}
</code></pre>
<p>Der Zugriff auf die DLL gelingt nicht. Das hDllInst ist nach dem LoadLibrary-Aufruf NULL.<br />
Ich habe den kompletten Code in ein neues Projekt kopiert und der Zugriff auf die DLL funktioniert ohne Änderungen am Programmcode.<br />
Die DLL-Datei befindet sich jeweils im gleichen Verzeichnis wie das Hauptprogramm und die DLL-Datei ist definitiv funktionsfähig. Sie arbeitet problemlos mit der BCB5 Version des Programmes. Der Zugriff auf die DLL erfolgt in dem Programm in der gleichen Weise abgesehen von den Hinweistexten im Edit1-Feld.</p>
<p>Mir fällt keine Debugmöglichkeit ein.<br />
Ich vermute irgendeine Projektoption verhindert den Zugriff auf die DLL.<br />
Aber die Suche danach ist wie die Suche nach der Nadel im Heuhaufen.</p>
<p>Hat jemand eine Idee. Vielleicht ist das Problem ja schon mal bei jemand anders aufgetreten.<br />
Achja, Update 2 ist installiert.</p>
<p>Vielen Dank</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1074264</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1074264</guid><dc:creator><![CDATA[barnie]]></dc:creator><pubDate>Fri, 09 Jun 2006 01:34:01 GMT</pubDate></item><item><title><![CDATA[Reply to LoadLibrary mit BDS2006 on Fri, 09 Jun 2006 04:20:06 GMT]]></title><description><![CDATA[<p>mich würd' interessieren, was</p>
<pre><code class="language-cpp">hDllInst=LoadLibrary(&quot;dlldatei.dll&quot;);

if( !hDllInst ) {

    ::GetLastError() // &lt;&lt;=============
    Edit1-&gt;Text=&quot;NODLL&quot;;

} else {

    Edit1-&gt;Text = &quot;DLL&quot;;
    pFunktion = ( Funktion* ) ::GetProcAddress( (HMODULE)hDllInst, &quot;DllFunktion&quot;);                                                      
        // ^ Brauchst übrigens hier nicht nach HMODULE casten denn HINSTANCE ist ein
        //   typedef für HMODULE.
    (pFunktion)( 5000 );
        // ^ musst pFunction nicht klammern
    FreeLibrary( hDllInst );
}
</code></pre>
<p>an dieser Stelle liefert.</p>
<p>Greetz, Swordfish.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1074272</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1074272</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Fri, 09 Jun 2006 04:20:06 GMT</pubDate></item><item><title><![CDATA[Reply to LoadLibrary mit BDS2006 on Sat, 10 Jun 2006 00:23:21 GMT]]></title><description><![CDATA[<p>GetLastError() liefert &quot;998&quot;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1074890</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1074890</guid><dc:creator><![CDATA[barnie]]></dc:creator><pubDate>Sat, 10 Jun 2006 00:23:21 GMT</pubDate></item><item><title><![CDATA[Reply to LoadLibrary mit BDS2006 on Sat, 10 Jun 2006 04:04:11 GMT]]></title><description><![CDATA[<p>998 = Invalid access to memory location.=ERROR_NOACCESS</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1074909</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1074909</guid><dc:creator><![CDATA[Christian211]]></dc:creator><pubDate>Sat, 10 Jun 2006 04:04:11 GMT</pubDate></item><item><title><![CDATA[Reply to LoadLibrary mit BDS2006 on Sun, 11 Jun 2006 21:17:29 GMT]]></title><description><![CDATA[<p>Die Fehlerbezeichnung war mir bekannt.<br />
Die verschiedenen Erklärungen und Hinweise im Internet, unter anderem bei MS fand ich nur ein wenig schwammig was die Fehlersuche ein wenig schwierig macht.<br />
Wie bereits gesagt, die DLL läuft mit der alten Programmversion, die an der Aufrufstelle den gleichen Code enthält perfekt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1075876</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1075876</guid><dc:creator><![CDATA[barnie]]></dc:creator><pubDate>Sun, 11 Jun 2006 21:17:29 GMT</pubDate></item></channel></rss>