<?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 Funktion kann nich Aufgerufen werden?]]></title><description><![CDATA[<p>Hallo Zusammen,</p>
<p>habe mir folgende DLL Datei erstellt.</p>
<pre><code class="language-cpp">extern &quot;C&quot; _declspec(dllexport) int _stdcall TestDll(double TS)
{
		return 112;
}

BOOL APIENTRY DllMain( HANDLE hModule, 
                       DWORD  ul_reason_for_call, 
                       LPVOID lpReserved
					 )
{
     return TRUE;
}
</code></pre>
<p>und will die erstellte DLL Datei &quot;TDLL.dll&quot; in einer Konsolenanwendung starten und zwar folgendermaßen:</p>
<pre><code class="language-cpp">#include &quot;stdafx.h&quot;
#include &lt;windows.h&gt;
#include &lt;winbase.h&gt;

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
	typedef UINT (CALLBACK* LPFNDLLFUNC1)(double);

HINSTANCE hDLL;               // Handle to DLL
LPFNDLLFUNC1 lpfnDllFunc1;    // Function pointer

hDLL = LoadLibrary(&quot;TDLL.dll&quot;);
if (hDLL != NULL)
{
   lpfnDllFunc1 = (LPFNDLLFUNC1)GetProcAddress(hDLL,
                                           &quot;_TestDll&quot;);
   if (!lpfnDllFunc1)
   {
      // handle the error
      FreeLibrary(hDLL);
      return -1;
   }
   else
   {
      // call the function
      int rc = lpfnDllFunc1(111.0);
   }
}
</code></pre>
<p>Der Funktionszeiger &quot;lpfnDllFunc1&quot; sagt mir es wird keine Funktion gefunden. Und die Bibliothek wird mit FreeLibrary freigegeben.</p>
<p>Unter den .NET C# kann ich auf die Funktion zugreifen. Wo kann der Fehler liegen?</p>
<p>THX</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/76246/dll-funktion-kann-nich-aufgerufen-werden</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 10:20:18 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/76246.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 09 Jun 2004 09:10:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to DLL Funktion kann nich Aufgerufen werden? on Wed, 09 Jun 2004 09:10:30 GMT]]></title><description><![CDATA[<p>Hallo Zusammen,</p>
<p>habe mir folgende DLL Datei erstellt.</p>
<pre><code class="language-cpp">extern &quot;C&quot; _declspec(dllexport) int _stdcall TestDll(double TS)
{
		return 112;
}

BOOL APIENTRY DllMain( HANDLE hModule, 
                       DWORD  ul_reason_for_call, 
                       LPVOID lpReserved
					 )
{
     return TRUE;
}
</code></pre>
<p>und will die erstellte DLL Datei &quot;TDLL.dll&quot; in einer Konsolenanwendung starten und zwar folgendermaßen:</p>
<pre><code class="language-cpp">#include &quot;stdafx.h&quot;
#include &lt;windows.h&gt;
#include &lt;winbase.h&gt;

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
	typedef UINT (CALLBACK* LPFNDLLFUNC1)(double);

HINSTANCE hDLL;               // Handle to DLL
LPFNDLLFUNC1 lpfnDllFunc1;    // Function pointer

hDLL = LoadLibrary(&quot;TDLL.dll&quot;);
if (hDLL != NULL)
{
   lpfnDllFunc1 = (LPFNDLLFUNC1)GetProcAddress(hDLL,
                                           &quot;_TestDll&quot;);
   if (!lpfnDllFunc1)
   {
      // handle the error
      FreeLibrary(hDLL);
      return -1;
   }
   else
   {
      // call the function
      int rc = lpfnDllFunc1(111.0);
   }
}
</code></pre>
<p>Der Funktionszeiger &quot;lpfnDllFunc1&quot; sagt mir es wird keine Funktion gefunden. Und die Bibliothek wird mit FreeLibrary freigegeben.</p>
<p>Unter den .NET C# kann ich auf die Funktion zugreifen. Wo kann der Fehler liegen?</p>
<p>THX</p>
]]></description><link>https://www.c-plusplus.net/forum/post/536556</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/536556</guid><dc:creator><![CDATA[sadza79]]></dc:creator><pubDate>Wed, 09 Jun 2004 09:10:30 GMT</pubDate></item><item><title><![CDATA[Reply to DLL Funktion kann nich Aufgerufen werden? on Wed, 09 Jun 2004 09:48:30 GMT]]></title><description><![CDATA[<p>Guck doch mal mit dem Depencies Walker nach unter welchem Namen die Funktion exportiert wurde, denn manchmal werden sie vollkommen anders expoprtiert als du es willst (zum Beispiel aus der Funktion &quot;Testabcxyz&quot; kann &quot;???__?@Testabcxyz&quot; werden)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/536580</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/536580</guid><dc:creator><![CDATA[jeanlebon]]></dc:creator><pubDate>Wed, 09 Jun 2004 09:48:30 GMT</pubDate></item><item><title><![CDATA[Reply to DLL Funktion kann nich Aufgerufen werden? on Wed, 09 Jun 2004 11:28:07 GMT]]></title><description><![CDATA[<p>Hallo jeanlebon</p>
<p>kannst du mir sagen was der Depencies Walker ist, ein externes Tool?<br />
Oder wie Funktionier das ganze?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/536681</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/536681</guid><dc:creator><![CDATA[sadza79]]></dc:creator><pubDate>Wed, 09 Jun 2004 11:28:07 GMT</pubDate></item><item><title><![CDATA[Reply to DLL Funktion kann nich Aufgerufen werden? on Wed, 09 Jun 2004 11:38:55 GMT]]></title><description><![CDATA[<p>der walker ist ein tool das beim visual studio dabei ist oder <a href="http://www.dependencywalker.com/" rel="nofollow">http://www.dependencywalker.com/</a></p>
<p>so müsste es gehen</p>
<pre><code class="language-cpp">int _tmain(int argc, _TCHAR* argv[])
{
	typedef int (*LPFNDLLFUNC1)(double);  // int nicht unsigned int / warum auf callback casten ?

HINSTANCE hDLL;               // Handle to DLL
LPFNDLLFUNC1 lpfnDllFunc1;    // Function pointer

hDLL = LoadLibrary(&quot;TDLL.dll&quot;);
if (hDLL != NULL)
{
   lpfnDllFunc1 = (LPFNDLLFUNC1)GetProcAddress(hDLL,
                                           &quot;TestDll&quot;); // ohne underline 
   if (!lpfnDllFunc1)
   {
      // handle the error
      FreeLibrary(hDLL);
      return -1;
   }
   else
   {
      // call the function
      int rc = lpfnDllFunc1(111.0);
   }
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/536704</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/536704</guid><dc:creator><![CDATA[miller_m]]></dc:creator><pubDate>Wed, 09 Jun 2004 11:38:55 GMT</pubDate></item><item><title><![CDATA[Reply to DLL Funktion kann nich Aufgerufen werden? on Wed, 09 Jun 2004 11:59:57 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>danke für die Vorschläge. Mit den Dependency Walker habe ich den Namen der Funktion herausgefinden &quot;_TestDll@4&quot;. Jetzt kann ich auf die Funktion zugreifen. Nur frage ich mich ist das denn so richtig. Das kann doch nicht sein das ich ein externes Tool benötige um den Namen meiner selbst erzeugten Funktion herauszufinden. Oder woran liegt das und muss man da etwas einstellen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/536731</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/536731</guid><dc:creator><![CDATA[sadza79]]></dc:creator><pubDate>Wed, 09 Jun 2004 11:59:57 GMT</pubDate></item><item><title><![CDATA[Reply to DLL Funktion kann nich Aufgerufen werden? on Wed, 09 Jun 2004 12:14:59 GMT]]></title><description><![CDATA[<p>nein du brauchst kein externes tool, ist nur dazu gedacht um deine dll zu überprüfen. einstellen musst du auch nix.</p>
<p>es geht also nicht so wie ich beschrieben habe ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/536763</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/536763</guid><dc:creator><![CDATA[miller_m]]></dc:creator><pubDate>Wed, 09 Jun 2004 12:14:59 GMT</pubDate></item><item><title><![CDATA[Reply to DLL Funktion kann nich Aufgerufen werden? on Wed, 09 Jun 2004 12:23:39 GMT]]></title><description><![CDATA[<p>Nein, nur wenn ich den kompletten Namen &quot;_TestDll@4&quot; eingebe. Schreibe ich &quot;TestDll&quot;, dann ist der Funktionszeiger NULL!</p>
<p>Ist da was Falsch in der DLL. Wie gesagt mit den C# kann ich &quot;TestDll&quot; eingeben<br />
und das ganze Funktioniert!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/536775</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/536775</guid><dc:creator><![CDATA[sadza79]]></dc:creator><pubDate>Wed, 09 Jun 2004 12:23:39 GMT</pubDate></item></channel></rss>