<?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[Fehlermeldung bei LoadLibrary]]></title><description><![CDATA[<p>Hallo Zusammen,</p>
<p>ich bin gerade dabei ein C++ Programm mit eVC++ zu schreiben. Dabei möchte ich den Befehl LoadLibrary ausführen um eine .dll zu laden. Beim Kompilieren kommt folgende Fehlermeldung:</p>
<p>E:\Dokumente und Einstellungen\rrflin\Desktop\CAN_Read_Write_dll\a\dummy\dummyDlg.cpp(117) : error C2664: 'LoadLibraryW' : cannot convert parameter 1 from 'char [6]' to 'const unsigned short *'</p>
<p>Der Fehler tritt auf, in der Zeile:<br />
HINSTANCE hm = LoadLibrary(&quot;a.dll&quot;);</p>
<p>Die .dll heißt a.dll. Hier ist der Code mit dem ich Versuche die a.dll zu laden:</p>
<pre><code class="language-cpp">#include &lt;stdio.h&gt;
#include &lt;windows.h&gt;
#include &lt;iostream.h&gt;
#include &quot;stdafx.h&quot;
#include &quot;dummy.h&quot;
#include &quot;dummyDlg.h&quot;
#include &quot;a.h&quot;
#include &quot;CAN.h&quot;
#include &quot;canbusio.h&quot;

	void CDummyDlg::OnButton1() 
{
	// TODO: Add your control notification handler code here

	typedef char* (*PFUNC_charp)(void);
	typedef void (*PFUNC_void)(void);
	//const unsigned short dll_name[6]={'a','.','d','l','l','\0'};
	const unsigned short dll_func_name[9] ={'C','A','N','_','I','n','i','t','\0'};
	int dll_count=0;
	char *dll_fp;
	HINSTANCE hm = LoadLibrary(&quot;a.dll&quot;);
    if (!hm)
    {
      //printf(&quot;Konnte DLL a.dll nicht laden!\n&quot;);
    }

PFUNC_charp init_plugin = (PFUNC_charp)GetProcAddress((HINSTANCE)hm, &amp;dll_func_name[0]);    

	if (init_plugin != NULL)
    {
		//printf (&quot;CAN_Init existiert!\n&quot;); 
		dll_fp=init_plugin(); 

		//const unsigned short *func_name = (unsigned short)&amp;dll_fp;
				//PFUNC_void function2 = (PFUNC_charp)GetProcAddress((HINSTANCE)hm, func_name);    // hier kracht es!

		//cout &lt;&lt; dll_fp &lt;&lt; endl;
    }
	else
		//printf(&quot;init_plugin() nicht gefunden!\n&quot;); 

	FreeLibrary((HMODULE)hm);

}
</code></pre>
<p>was mache ich falsch?</p>
<p>Gruß<br />
spacehelix</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/142909/fehlermeldung-bei-loadlibrary</link><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Jul 2026 22:38:23 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/142909.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 04 Apr 2006 07:12:12 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Fehlermeldung bei LoadLibrary on Tue, 04 Apr 2006 07:12:12 GMT]]></title><description><![CDATA[<p>Hallo Zusammen,</p>
<p>ich bin gerade dabei ein C++ Programm mit eVC++ zu schreiben. Dabei möchte ich den Befehl LoadLibrary ausführen um eine .dll zu laden. Beim Kompilieren kommt folgende Fehlermeldung:</p>
<p>E:\Dokumente und Einstellungen\rrflin\Desktop\CAN_Read_Write_dll\a\dummy\dummyDlg.cpp(117) : error C2664: 'LoadLibraryW' : cannot convert parameter 1 from 'char [6]' to 'const unsigned short *'</p>
<p>Der Fehler tritt auf, in der Zeile:<br />
HINSTANCE hm = LoadLibrary(&quot;a.dll&quot;);</p>
<p>Die .dll heißt a.dll. Hier ist der Code mit dem ich Versuche die a.dll zu laden:</p>
<pre><code class="language-cpp">#include &lt;stdio.h&gt;
#include &lt;windows.h&gt;
#include &lt;iostream.h&gt;
#include &quot;stdafx.h&quot;
#include &quot;dummy.h&quot;
#include &quot;dummyDlg.h&quot;
#include &quot;a.h&quot;
#include &quot;CAN.h&quot;
#include &quot;canbusio.h&quot;

	void CDummyDlg::OnButton1() 
{
	// TODO: Add your control notification handler code here

	typedef char* (*PFUNC_charp)(void);
	typedef void (*PFUNC_void)(void);
	//const unsigned short dll_name[6]={'a','.','d','l','l','\0'};
	const unsigned short dll_func_name[9] ={'C','A','N','_','I','n','i','t','\0'};
	int dll_count=0;
	char *dll_fp;
	HINSTANCE hm = LoadLibrary(&quot;a.dll&quot;);
    if (!hm)
    {
      //printf(&quot;Konnte DLL a.dll nicht laden!\n&quot;);
    }

PFUNC_charp init_plugin = (PFUNC_charp)GetProcAddress((HINSTANCE)hm, &amp;dll_func_name[0]);    

	if (init_plugin != NULL)
    {
		//printf (&quot;CAN_Init existiert!\n&quot;); 
		dll_fp=init_plugin(); 

		//const unsigned short *func_name = (unsigned short)&amp;dll_fp;
				//PFUNC_void function2 = (PFUNC_charp)GetProcAddress((HINSTANCE)hm, func_name);    // hier kracht es!

		//cout &lt;&lt; dll_fp &lt;&lt; endl;
    }
	else
		//printf(&quot;init_plugin() nicht gefunden!\n&quot;); 

	FreeLibrary((HMODULE)hm);

}
</code></pre>
<p>was mache ich falsch?</p>
<p>Gruß<br />
spacehelix</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1030023</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1030023</guid><dc:creator><![CDATA[spacehelix]]></dc:creator><pubDate>Tue, 04 Apr 2006 07:12:12 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlermeldung bei LoadLibrary on Tue, 04 Apr 2006 07:33:41 GMT]]></title><description><![CDATA[<p>Es wird UNICODE verwendest und deshalb musst Du Deine String für OS-Aufrufe mit &quot;L&quot; versehen (oder Du nimmt _T):</p>
<pre><code class="language-cpp">LoadLibrary(L&quot;a.dll&quot;)
</code></pre>
<p>oeder</p>
<pre><code class="language-cpp">#include &lt;tchar.h&gt;
LoadLibrary(_T(&quot;a.dll&quot;));
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1030034</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1030034</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Tue, 04 Apr 2006 07:33:41 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlermeldung bei LoadLibrary on Tue, 04 Apr 2006 07:46:19 GMT]]></title><description><![CDATA[<p>Danke Jochen es funktioniert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1030052</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1030052</guid><dc:creator><![CDATA[spacehelix]]></dc:creator><pubDate>Tue, 04 Apr 2006 07:46:19 GMT</pubDate></item></channel></rss>