interop for string[] array
- From: "Egbert Nierop \(MVP for IIS\)" <egbert_nierop@xxxxxxxxxxxxxx>
- Date: Fri, 18 Nov 2005 01:44:14 +0100
The P/I function ADsBuildVarArrayStr works. When I look at the IL, no heavy Marshal code is done. I even suspect, that a pointer is passed to the array and that the array even not is pinned.
But when it comes to passing a string[] array through a struct, it does not work. Are there any secrets? (I'm using .NET 2.0)
sample what I would like to pass to a win32 function
struct blah
{
int cElements;
string [] elements
}[DllImport("Activeds.dll", SetLastError = false, CharSet = CharSet.Unicode)]public static extern int ADsBuildVarArrayStr(// [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr)]
string[] lppPathNames,
int arrayLen,
[MarshalAs(UnmanagedType.Struct)]
out object varArray);
newarr [mscorlib]System.String
stloc.s CS$0$0000
ldloc.s CS$0$0000
ldc.i4.0
ldstr "hoi"
stelem.ref
ldloc.s CS$0$0000
: ldc.i4.1
ldstr "doei"
: stelem.ref
ldloc.s CS$0$0000
: stloc.1
ldloc.1
ldc.i4.2
ldloca.s bla
call int32 NWCNameTranslate::ADsBuildVarArrayStr(string[], int32, object&)
.
- Follow-Ups:
- Re: interop for string[] array
- From: Lucvdv
- Re: interop for string[] array
- Prev by Date: Re: PIA for Shell32
- Next by Date: RE: STAThreadAttribute is ignored in .net Framework 2.0?
- Previous by thread: At witt's end!!!! QueryInterface for interface xxx failed.
- Next by thread: Re: interop for string[] array
- Index(es):
Relevant Pages
|