This is exactly the same problem I'm having. Have you got any code samples
you could post or url's I can refer to?
Hi Steve,
sorry for the late answer.
I couldn't solve the problem - so i found a workaround for this.
I've used a wrapper for the list and returned this instead of the
array.
Alternatively you can also use one of the list-Classes provided by
System.Collections. ...
here is what i did:
[Guid("xxxxxxxxxxxxxxx")]
[ComVisible(true)]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface ITeststructCollection {
void add(teststruct c);
int count();
teststruct get([MarshalAs(UnmanagedType.I4)] int i);
void Dispose();
};
and the implementation for this (TeststructCollection).
the call which returns the Interface looks like
TeststructCollection
GetCallEntries([MarshalAs(UnmanagedType.LPStr)]string smthing, int i);
Native code looks like this
...
_CallEntryCollectionPtr entries=engine-
>GetCallEntries(pszSmthing,i);
CoTaskMemFree(pszSmthing);
ICallEntryCollection *coll;
hResult=entries->QueryInterface(&coll);
if (FAILED(hResult)) {
char ch[255];
::FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,NULL,hResult,NULL,ch,
255,NULL);
char pszErr[1024];
sprintf(pszErr,"Reading COM-Entries Error: 0x%08x - %s
\n",hResult,ch);
fprintf(stderr,pszErr);
return ;
}
int count=coll->count();
...
hope this helps.
br
HPW
> This is exactly the same problem I'm having. Have you got any code samples
> you could post or url's I can refer to?
[quoted text clipped - 14 lines]
>
> > Cartoper