<?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 aus der DLL heraus.]]></title><description><![CDATA[<p>Hallo zusammen. bin gerade dabei, einen den Quellcode einer EXE in eine DLL umzubauen. In der EXE wurde mit LoadLibrary gearbeitet (nur dlls als Quelle, keine Lib). Das scheint jedoch in der DLL nicht mehr zu funktionieren.</p>
<p>Gearbeitet wird unter Visual C++ 2008.</p>
<p>Folgende Fehlermeldung erscheint:</p>
<blockquote>
<p>error C2664: 'LoadLibraryW': Konvertierung des Parameters 1 von 'const char [16]' in 'LPCWSTR' nicht möglich.<br />
Die Typen, auf die verwiesen wird, sind nicht verknüpft; die Konvertierung erfordert einen reinterpret_cast-Operator oder eine Typumwandlung im C- oder Funktionsformat.</p>
</blockquote>
<p>Auszug des Quelltextes:</p>
<pre><code class="language-cpp">#include &lt;string.h&gt;
#include &lt;stdio.h&gt;
#include &lt;windows.h&gt;

.
.
.

extern &quot;C&quot; void __declspec(dllexport) __cdecl EXPORTNAME
(float *a,int *b, char *c, char *d, char *e)

{
typedef void (_cdecl *MYPROC)(double*, double*); 

HINSTANCE hinstlib_ctrl;

MYPROC call_controller;

hinstlib_ctrl = LoadLibrary(&quot;DLLNAME.dll&quot;); // compiler ERROR in dieser Zeile

//call_controller=(MYPROC)GetProcAddress(hinstlib_ct rl,&quot;Controller&quot;); 

.
.
.
</code></pre>
<p>Hat jemand einen Tipp?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/264161/loadlibrary-aus-der-dll-heraus</link><generator>RSS for Node</generator><lastBuildDate>Sat, 05 Sep 2026 04:59:45 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/264161.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 03 Apr 2010 13:00:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to LoadLibrary aus der DLL heraus. on Sat, 03 Apr 2010 13:00:02 GMT]]></title><description><![CDATA[<p>Hallo zusammen. bin gerade dabei, einen den Quellcode einer EXE in eine DLL umzubauen. In der EXE wurde mit LoadLibrary gearbeitet (nur dlls als Quelle, keine Lib). Das scheint jedoch in der DLL nicht mehr zu funktionieren.</p>
<p>Gearbeitet wird unter Visual C++ 2008.</p>
<p>Folgende Fehlermeldung erscheint:</p>
<blockquote>
<p>error C2664: 'LoadLibraryW': Konvertierung des Parameters 1 von 'const char [16]' in 'LPCWSTR' nicht möglich.<br />
Die Typen, auf die verwiesen wird, sind nicht verknüpft; die Konvertierung erfordert einen reinterpret_cast-Operator oder eine Typumwandlung im C- oder Funktionsformat.</p>
</blockquote>
<p>Auszug des Quelltextes:</p>
<pre><code class="language-cpp">#include &lt;string.h&gt;
#include &lt;stdio.h&gt;
#include &lt;windows.h&gt;

.
.
.

extern &quot;C&quot; void __declspec(dllexport) __cdecl EXPORTNAME
(float *a,int *b, char *c, char *d, char *e)

{
typedef void (_cdecl *MYPROC)(double*, double*); 

HINSTANCE hinstlib_ctrl;

MYPROC call_controller;

hinstlib_ctrl = LoadLibrary(&quot;DLLNAME.dll&quot;); // compiler ERROR in dieser Zeile

//call_controller=(MYPROC)GetProcAddress(hinstlib_ct rl,&quot;Controller&quot;); 

.
.
.
</code></pre>
<p>Hat jemand einen Tipp?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1877123</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1877123</guid><dc:creator><![CDATA[DampfHans]]></dc:creator><pubDate>Sat, 03 Apr 2010 13:00:02 GMT</pubDate></item><item><title><![CDATA[Reply to LoadLibrary aus der DLL heraus. on Sat, 03 Apr 2010 13:12:41 GMT]]></title><description><![CDATA[<p>C++ Grundwissen aneignen. Du verwendest die falschen Typen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1877127</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1877127</guid><dc:creator><![CDATA[Janjan]]></dc:creator><pubDate>Sat, 03 Apr 2010 13:12:41 GMT</pubDate></item><item><title><![CDATA[Reply to LoadLibrary aus der DLL heraus. on Sat, 03 Apr 2010 13:28:02 GMT]]></title><description><![CDATA[<p>was mit stutzig macht ist aber,</p>
<p>das selbst hinstlib_ctrl = LoadLibrary(_T(&quot;DLLNAME.dll&quot;)); bzw. LoadLibraryA( bzw. LoadLibraryW(L nicht funktionieren...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1877131</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1877131</guid><dc:creator><![CDATA[DampfHans]]></dc:creator><pubDate>Sat, 03 Apr 2010 13:28:02 GMT</pubDate></item><item><title><![CDATA[Reply to LoadLibrary aus der DLL heraus. on Sat, 03 Apr 2010 15:15:52 GMT]]></title><description><![CDATA[<p>DampfHans schrieb:</p>
<blockquote>
<p>was mit stutzig macht ist aber,</p>
<p>das selbst hinstlib_ctrl = LoadLibrary(_T(&quot;DLLNAME.dll&quot;)); bzw. LoadLibraryA( bzw. LoadLibraryW(L nicht funktionieren...</p>
</blockquote>
<p>Was heist <em>nicht</em> funktionieren, kommt der selbe Fehler vom Kompiler, ein anderer oder gar ein Laufzeitfehler?</p>
<p>Denn entweder sollte LoadLibrary(L&quot;dllname.dll&quot;), LoadLibraryA(&quot;dllname.dll&quot;) gehen (sofern Du mit UNICODE-Flag kompilierst).</p>
<p>Wenn Du auf Unicode verzichten kannst dann kannst Du auch ohne dieser kompilieren und dann sollte LoadLibrary(&quot;dllname.dll&quot;) ebenfalls gehen weil dann LoadLibraryA genommen wird (LoadLibrary selbst ist ja nur ein Macro).</p>
<p>Gut Schuß<br />
VuuRWerK <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/1877161</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1877161</guid><dc:creator><![CDATA[VuuRWerK]]></dc:creator><pubDate>Sat, 03 Apr 2010 15:15:52 GMT</pubDate></item></channel></rss>