LPSAFEARRAY and C#

  • Thread starter Thread starter Steven Blair
  • Start date Start date
S

Steven Blair

Hi,

I am trying to use a function from C Win32 dll:

short APIENTRY TPE_NIP_View ( BSTR *filename,
LPSAFEARRAY *nipItemArr )

From C# I call the function:

NIP_ITEM[] nipItemArray;
err = TPE_NIP_View( ref str, out nipItemArray );

//nipItemArray is a struct and its definition is:

public struct NIP_ITEM
{
short theType;
short level;
short id;
string name;
string data;
}

When the dll function is finised, I get an unhandled exception. I have
stepped through the DLL and there doesnt appear to be any problems. I
think this line is the cause:

*nipItemArr = tmpArr; //last line of C dll

Any help on this would be appreciated

Regards,

Steven
 
Back
Top