<?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[Pointer als Paramerter übergeben]]></title><description><![CDATA[<p>hi,</p>
<p>folgendes problem, ich habe 2 verschiedene dll's, ich nenne sie jetzt der einfachheit halber mal dll_a und dll_b.<br />
in der dll_b habe ich eine funktion definiert, deren parameter wie folgt aussehen:</p>
<pre><code>int getData (char *Label, int *SafeAt, int length, BOOL UseOld)
</code></pre>
<p>die dll_b wird innerhalb der dll_a geladen und auf die funktion getData zugegriffen.<br />
in dieser funktion werden dann pfade, etc. berechnet und zB in den parameter<br />
*SafeAt geschrieben. sodass ich den wert auch in der dll_a nutzen kann.<br />
genau da kommt das der fehler --&gt; access violation. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f621.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--pouting_face"
      title=":rage:"
      alt="😡"
    /></p>
<p>sorry, ist etwas komisch zu erklären, könnt ihr trotzdem etwas damit anfangen?</p>
<p>kann mir bitte jemand sagen warum ich nicht in den pointer schreiben kann?</p>
<p>wär super wenn mir jemand helfen könnte.</p>
<p>thx</p>
<p>deflow</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/149677/pointer-als-paramerter-übergeben</link><generator>RSS for Node</generator><lastBuildDate>Sat, 05 Sep 2026 08:33:38 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/149677.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 08 Jun 2006 11:01:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Pointer als Paramerter übergeben on Thu, 08 Jun 2006 11:01:49 GMT]]></title><description><![CDATA[<p>hi,</p>
<p>folgendes problem, ich habe 2 verschiedene dll's, ich nenne sie jetzt der einfachheit halber mal dll_a und dll_b.<br />
in der dll_b habe ich eine funktion definiert, deren parameter wie folgt aussehen:</p>
<pre><code>int getData (char *Label, int *SafeAt, int length, BOOL UseOld)
</code></pre>
<p>die dll_b wird innerhalb der dll_a geladen und auf die funktion getData zugegriffen.<br />
in dieser funktion werden dann pfade, etc. berechnet und zB in den parameter<br />
*SafeAt geschrieben. sodass ich den wert auch in der dll_a nutzen kann.<br />
genau da kommt das der fehler --&gt; access violation. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f621.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--pouting_face"
      title=":rage:"
      alt="😡"
    /></p>
<p>sorry, ist etwas komisch zu erklären, könnt ihr trotzdem etwas damit anfangen?</p>
<p>kann mir bitte jemand sagen warum ich nicht in den pointer schreiben kann?</p>
<p>wär super wenn mir jemand helfen könnte.</p>
<p>thx</p>
<p>deflow</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1073756</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1073756</guid><dc:creator><![CDATA[deflow]]></dc:creator><pubDate>Thu, 08 Jun 2006 11:01:49 GMT</pubDate></item><item><title><![CDATA[Reply to Pointer als Paramerter übergeben on Thu, 08 Jun 2006 11:07:03 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>läßt sich nur aus dem Prototyp der Funktion nicht sagen.<br />
Wahrtscheinlich greifst du auf ungültigen Speicher zu, weil du nichts für den char reserviert hast oder weil du den doch reservierten Speicher nicht korrekt übergibst.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1073762</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1073762</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Thu, 08 Jun 2006 11:07:03 GMT</pubDate></item><item><title><![CDATA[Reply to Pointer als Paramerter übergeben on Thu, 08 Jun 2006 11:07:33 GMT]]></title><description><![CDATA[<p>Schuss ins Blaue: Du übergibst einen nicht oder zu kurz initialisierten Array als SafeAt-Parameter?</p>
<p>Sorry, ohne zumindest den Aufruf-Code ist da sonst nicht viel zu raten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1073764</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1073764</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Thu, 08 Jun 2006 11:07:33 GMT</pubDate></item><item><title><![CDATA[Reply to Pointer als Paramerter übergeben on Thu, 08 Jun 2006 11:09:05 GMT]]></title><description><![CDATA[<p>das kann verschiedene gründe haben, aufrufer bietet zu wenig speicher an oder sowas. vielleicht kopierste mal die funktion in ein separates testprojekt und steppst mit'm debugger durch?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1073766</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1073766</guid><dc:creator><![CDATA[net 0]]></dc:creator><pubDate>Thu, 08 Jun 2006 11:09:05 GMT</pubDate></item><item><title><![CDATA[Reply to Pointer als Paramerter übergeben on Thu, 08 Jun 2006 12:58:52 GMT]]></title><description><![CDATA[<p>in der aufrufenden dll_a habe ich folgende variablen bzw pointer definiert, die ich dann der funktion übergebe:</p>
<p>in einer header:</p>
<pre><code>.
.
typedef int (*GET_UUT) (char *Label, char *SafeAt, int length, BOOL UseOld);
.
.
</code></pre>
<p>im konstruktor:</p>
<pre><code>.
.
this-&gt;m_Lookup_Dll_poi = LoadLibrary(&quot;Lookup.dll&quot;);
   if (m_Lookup_Dll_poi != NULL)
   {
	   m_GetData_poi = (GET_UUT)GetProcAddress(m_Lookup_Dll_poi, &quot;getData&quot;);								//Adress für Funktionaufruf ermitteln
   }
   else
   {
	   m_GetData_poi = NULL;
   }
.
.
</code></pre>
<p>aufruf der funktion getData:</p>
<pre><code>.
.
char *pPath = 0;
int id = 0;

id = m_GetData_poi(pLabel, pPath, 128, false);
.
.
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1073776</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1073776</guid><dc:creator><![CDATA[deflow]]></dc:creator><pubDate>Thu, 08 Jun 2006 12:58:52 GMT</pubDate></item><item><title><![CDATA[Reply to Pointer als Paramerter übergeben on Thu, 08 Jun 2006 11:23:32 GMT]]></title><description><![CDATA[<p>Dann vergleich mal die Parameterliste der Funktion mit dem Pointer, dem du sie zuweist (Tip:achte mal auf den Typ des zweiten Parameters).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1073779</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1073779</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Thu, 08 Jun 2006 11:23:32 GMT</pubDate></item><item><title><![CDATA[Reply to Pointer als Paramerter übergeben on Thu, 08 Jun 2006 11:28:04 GMT]]></title><description><![CDATA[<p>Mal ganz davon abgesehen ist pPath == 0, und da das kein Doppelzeiger (oder Referenz-auf-Zeiger) ist, kann dir getData dort nichts &quot;reinschreiben&quot; - da ist nämlich nichts zum reinschreiben.</p>
<p>(EDIT: Womit mein allererster Tipp sich bestätigen würde :D)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1073782</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1073782</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Thu, 08 Jun 2006 11:28:04 GMT</pubDate></item><item><title><![CDATA[Reply to Pointer als Paramerter übergeben on Thu, 08 Jun 2006 11:33:03 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/10318">@CStoll</a>: ups, hab vorhin bissel getestet, sollte eigentlich schon</p>
<pre><code>int getData (char *Label, char *SafeAt, int length, BOOL UseOld)
</code></pre>
<p>heißen ;P</p>
<p>sorry, ich blick gerade nicht mehr durch....steh voll aufm schlauch.<br />
was muss ich machen? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1073785</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1073785</guid><dc:creator><![CDATA[deflow]]></dc:creator><pubDate>Thu, 08 Jun 2006 11:33:03 GMT</pubDate></item><item><title><![CDATA[Reply to Pointer als Paramerter übergeben on Thu, 08 Jun 2006 11:38:02 GMT]]></title><description><![CDATA[<p>Entschuldigung, Du musst wissen was die DLL von Dir erwartet, nicht wir.</p>
<p>Jetzt mal basierend auf der Vermutung, die Funktion erwarte von Dir ein char-Array mit der Länge length, müsstest Du sowas tun:</p>
<pre><code class="language-cpp">int length = 128;
char *pPath = new char[length];
m_GetUUT_poi(pLabel, pPath, length, false);
</code></pre>
<p>Aber das hier ist alles <strong>Glaskugel</strong>!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1073788</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1073788</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Thu, 08 Jun 2006 11:38:02 GMT</pubDate></item><item><title><![CDATA[Reply to Pointer als Paramerter übergeben on Thu, 08 Jun 2006 11:55:44 GMT]]></title><description><![CDATA[<p>hab jetzt schon ein paar sachen durch probiert, selbst mit CString funktioniert es nicht...</p>
<p>ich poste gleich mal die aufrufende und die aufzurufende funktion, dann könnt ihr euch vielleicht ein bild machen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1073798</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1073798</guid><dc:creator><![CDATA[deflow]]></dc:creator><pubDate>Thu, 08 Jun 2006 11:55:44 GMT</pubDate></item><item><title><![CDATA[Reply to Pointer als Paramerter übergeben on Thu, 08 Jun 2006 12:06:24 GMT]]></title><description><![CDATA[<p>Testest du eigentlich auch ob m_GetData_poi evtl 0 ist? Weil GetProcAdress könnte dir auch 0 zurückgeben wenn es das Symbol nicht findet. =&gt; Accessviolation <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>
<p>BR</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1073810</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1073810</guid><dc:creator><![CDATA[evilissimo]]></dc:creator><pubDate>Thu, 08 Jun 2006 12:06:24 GMT</pubDate></item><item><title><![CDATA[Reply to Pointer als Paramerter übergeben on Thu, 08 Jun 2006 12:50:38 GMT]]></title><description><![CDATA[<p>hier der aufruf in dll_a:</p>
<pre><code>void Data::StartWork(char *Label)
{
    CString TmpLine, DataString, BatchString;
	char *CharHelp;

	BOOL Fehler = FALSE;
	int i;

	LabelOutString = Label;
	LabelOutString.Remove('\n');
	LabelOutString.Remove('\r');

	for (i = 0; i &lt; LabelOutString.GetLength(); i++)
		Label[i] = LabelOutString.GetAt(i);
	Label[i] = '\0';

	//Wenn das Label nicht gesetzt ist, muss nicht weiter gearbeitet werden
	if (Label[0] == '\0')
	{
		WriteLogFile(&quot;Empty Label - Batch neither Selected or executed&quot;);
		mScanField-&gt;setCaption(&quot;&quot;);
		return;
	}

	CString MB_OP;
	if ((NULL == m_GetData_poi) )
	{
		AfxMessageBox(&quot;TEST 2&quot;, MB_OK | MB_ICONERROR);
		mScanField-&gt;setCaption(&quot;&quot;);
		return;
	}

	CString Controller;
	GetconInfoPChar(cipControllerName, (tCiPId)0, Controller.GetBuffer(128), 128);

	if (-1 != Controller.Find(&quot;virtual controller&quot;, 0))
	{
		MB_OP.Format(&quot;warung, virtueller controller&quot;);
		Fehler = TRUE;
	}

	if (Fehler)
	{
		MB_OP = &quot;m_Language.Warning1&quot; + MB_OP + &quot;m_Language.Warning2&quot;;
		WriteLogFile(MB_OP);
		if (IDYES != MessageBox(NULL, MB_OP, &quot;m_Language.OwnName&quot;, MB_YESNO | MB_ICONWARNING))
		{
			WriteLogFile(&quot;User selected \&quot;NO\&quot;&quot;);
			mScanField-&gt;setCaption(&quot;&quot;);
			return;
		}
		WriteLogFile(&quot;User selected \&quot;Yes\&quot;&quot;);
	}

	CharHelp = DDERequest(&quot;STATE&quot;, 1024, TmpLine.GetBuffer(1024));
	TmpLine = TmpLine.GetBuffer(1024);

	if (NULL == CharHelp)
	{
		mScanField-&gt;setCaption(&quot;&quot;);
		return;
	}

	if (-1 == TmpLine.Find(&quot;DIR&quot;, 0))
		DataString = &quot;&quot;;
	else
	{
		TmpLine = TmpLine.Right(TmpLine.GetLength() - TmpLine.Find(&quot;DIR&quot;, 0) - 3);
		DataString = TmpLine.Left(TmpLine.Find(&quot;\n&quot;, 0));
		DataString.Remove('\r');
		DataString.TrimLeft();
		DataString.TrimRight();
		DataString = DataString.Left(DataString.ReverseFind('\\'));
	}

	if (-1 == TmpLine.Find(&quot;BATCH&quot;, 0))
		BatchString = &quot;&quot;;
	else
	{
		TmpLine = TmpLine.Right(TmpLine.GetLength() - TmpLine.Find(&quot;BATCH&quot;, 0) - 4);
		BatchString = TmpLine.Left(TmpLine.Find(&quot;\n&quot;, 0));
		BatchString = BatchString.Right(BatchString.GetLength() - 1 - BatchString.ReverseFind('\\'));
		BatchString.Remove('\r');
		BatchString.TrimLeft();
		BatchString.TrimRight();
	}

//*****************HIER DER AUFRUF******************************

	int id = 0;
	int length = 256;
	char *pPath = new char[length]; 

	a = m_GetData_poi(Label, pPath, length, false);

	.
	.
	.
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1073849</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1073849</guid><dc:creator><![CDATA[deflow]]></dc:creator><pubDate>Thu, 08 Jun 2006 12:50:38 GMT</pubDate></item><item><title><![CDATA[Reply to Pointer als Paramerter übergeben on Thu, 08 Jun 2006 12:52:34 GMT]]></title><description><![CDATA[<p>und hier die aufzurufende funktion in der dll_b:</p>
<pre><code>extern &quot;C&quot; __declspec(dllexport) int getData (char *Label, char *SafeAt, int length, BOOL UseOld)
{
	if ((Label == NULL) || ((CString)Label == &quot;&quot;))
		return -10;

	FILE *LookupFile;
	int rueck;
	LookupFile = OpenLookupFile(rueck, UseOld);

	if ((rueck != 0) || (LookupFile == NULL))
		return rueck;

	CString CompareLabel;

	CompareLabel = Label;
	if (-1 != CompareLabel.Find(&quot;#S&quot;, 0))
		CompareLabel = CompareLabel.Left(CompareLabel.Find(&quot;#S&quot;, 0));

	CString Line;
	char Buffer[1024], *FgetsRueck;

	while (NULL != (FgetsRueck = fgets(Buffer, 1023, LookupFile)) )
	{
		Line = Buffer;

		if (-1 != Line.Find(&quot;--&quot;, 0))
			Line = Line.Left(Line.Find(&quot;--&quot;, 0));

		if (-1 == Line.Find(&quot;$&quot;, 0))
			continue;

		if (Line.Find(CompareLabel, 0) != -1)
			break;
	}

	fclose(LookupFile);
	if (FgetsRueck == NULL)
		return -10;

	CString DataString;
	int pos;

	pos = Line.Find(&quot;$&quot;, 0);
	DataString = Line.Mid(pos + 1, Line.ReverseFind('$') - 1);
	DataString.TrimLeft();
	DataString.TrimRight();
	if (length &lt; DataString.GetLength())
		return -1;

	sprintf(SafeAt, &quot;%s&quot;, DataString);
	return 0;
}
</code></pre>
<p>vielleicht hilft das weiter.</p>
<p>hab den code gekürzt, nicht wundern wenn ein paar sachen unschlüssig sind <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/1073850</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1073850</guid><dc:creator><![CDATA[deflow]]></dc:creator><pubDate>Thu, 08 Jun 2006 12:52:34 GMT</pubDate></item><item><title><![CDATA[Reply to Pointer als Paramerter übergeben on Thu, 08 Jun 2006 12:54:20 GMT]]></title><description><![CDATA[<p>Aha. Hast du den typedef für UUT auch extern &quot;C&quot;?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1073853</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1073853</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Thu, 08 Jun 2006 12:54:20 GMT</pubDate></item><item><title><![CDATA[Reply to Pointer als Paramerter übergeben on Thu, 08 Jun 2006 13:01:31 GMT]]></title><description><![CDATA[<p>nein, den hab ich so in der header stehen wie vorn beschrieben:</p>
<pre><code>typedef int (*GET_UUT) (char *Label, char *SafeAt, int length, BOOL UseOld);
</code></pre>
<p>muss ich da extern &quot;C&quot; benutzen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1073864</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1073864</guid><dc:creator><![CDATA[deflow]]></dc:creator><pubDate>Thu, 08 Jun 2006 13:01:31 GMT</pubDate></item></channel></rss>