>I am new to C# programming and trying to convert a sample C program into C#.
>
>I'm successfully calling the first Dll call. But the second Dll call is using two structures and results in a MarshallDirectiveException (Method's type signature is not PInvoke compatible) error.
>
Just some misc. rambling, I'm not sure any of this will be of much help. But maybe it'll at least point you in the right direction.
When I played with PInvoke a while back I noticed things got "not so obvious" as soon as you needed to pass pointers around (eg. string *myStringPtr defines a pointer to a string named myStringPtr). Pointers are basically "ref" or "ByRef" (in VB) types. From what I found then, you can pass a char * out by using the StringBuilder class instead:
char *myStringPtr;
becomes
StringBuilder myStringPtr;
I have no idea if PInvoke will allow/marshall that inside of a structure, though.
Any lines like:
short int myIntValue;
become:
short myIntValue;
I don't know how you'd define an array of "short" inside of a structure that PInvoke can handle, though. Maybe a normal array might work:
short[] myShortInt = new short[10];
Or Maybe something in the in the Marshalling class?
System.Runtime.InteropServices.Marshal