How does this relate to your previous question?, this looks like a different
function.
Maybe it's time to read the Pinvoke stuff in MSDN, and to to take a look at
the samples too.
Willy.
"Wilfried Mestdagh" <Wi**************@discussions.microsoft.comwrote in
message news:72**********************************@microsof t.com...
| Hi,
|
| I tryed another approach, to just copy something to a string as argument,
| but have also strange result.
|
| char[] ver = new char[21];
| ApiDll.Version(ver, 20);
|
| And the dll:
|
| public static class ApiDll
| {
| [DllImport(dllName)]
| public static extern void
Version([MarshalAs(UnmanagedType.LPArray)]
| char[] c, int len);
|
| In the DLL I see the value given with the call. There I copy the string to
| the pointer, but in C# the result value is the same. It seems that a copy
is
| passed to the dll instead of the pointer.
|
| In the DLL (in Delphi):
|
| procedure Version(c: PChar; Len: integer): PChar; export; stdcall;
| begin
| c := StrPLCopy(c, 'hihihihi', 10);
| end;
|
| But the "hihihi" never visisble in C# calling program.
|
| I tryed with the 'out' argument, but this gives me exception errors. So I
| think I have to go back to the return value. But dont kno whow..;.
|
| --
| rgds, Wilfried
|
http://www.mestdagh.biz