Einzelnen Beitrag anzeigen

Benutzerbild von weltaran
weltaran

Registriert seit: 12. Sep 2003
Ort: Offenburg
78 Beiträge
 
Delphi 5 Enterprise
 
#10

Re: Parameterübergabe: was geht hier vor?

  Alt 6. Mai 2005, 16:15
Hallo!


Ich habe nochmal einige Möglichkeiten durchgecheckt. Tatsache ist, dass ich Strings, die ich lediglich an die DLL übergebe und darin NICHT verändern will, mittels PWideChar übergebe und dies funktioniert tadellos. Mache ich das auch mit den zu verändernden Strings, so kommen nur Fragezeichen zurück

Bei der aufrufenden Anwendung handelt es sich übrigens um TestStand von NationalInstruments. Die Hilfe sagt zur Übergabe von Strings folgendes:

Zitat:
In general, when you use string parameters, use one of the buffer types if
you want the DLL function to be able to change the contents of the
argument in TestStand. Use the C String or Unicode String type if the DLL
function does not modify the argument.

If you specify one of the string buffer types, the DLL-adapter copies the contents
of the string argument and a trailing zero element into a temporary buffer
before calling the DLL function. You specify the minimum size of the
temporary buffer in the Number of Elements control. If the string value is
longer than the buffer size you specify, the adapter resizes the temporary
buffer so that it is large enough to hold contents of the string argument and
the trailing zero element. After the DLL function returns, TestStand copies
the value that the function writes into the temporary buffer back to the
string argument.
If you specify the C String or Unicode String type, the adapter passes the
address of the actual string directly to the function without copying it to a
buffer. The code module must not change the contents of the string.

Ich habe die in C geschriebene Minimal-DLL auf TestStand losgelassen - keine Probleme. Aber ich will/muss nun mal Delphi für mein Projekt nehmen.



Ich forsche weiter an der Sache aber so langsam (nach etlichen Tagen! des Ausprobierens) habe ich die Schnauze voll.

So long.

weltaran
  Mit Zitat antworten Zitat