answer:
Have a look at David Heffernan's comments - he seems more knowledgeable and to have spent a lot more time on this.
previous attempts:
Then again, after some more search, that should answer your exact question.
If you want to marshal to char* (which basically is the same as char[]) you will need to use a StringBuilder.
See this completely unrelated example that shows the signature from pinvoke.net.
You should then either recreate your structure or internally copy/convert it (if used elsewhere as well) to the following:
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
public struct CallbackParams
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
public StringBuilder displayName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
public StringBuilder userName;
}
Also be careful that StringBuilder already does all the marshalling automatically.. also there is no need for the ref anymore. Actually, using ref will cause problems.
cb.displayName = "XYZ";
cb.userName = "ABC";
code = 0;
DLLCBFunc1(code, cb);
Don't know out of my head about assigning strings to stringbuilders.. might be you have to do
cb.displayName = new StringBuilder("XYZ");
edit
As David Hefferman has pointed out.. I have missed the point. :)
So... in your case you probably will have to declare the char[80] as Byte[80] arrays and manually copying the string's content, also making sure to mind the likely unicode->ansi conversion. Also, after the call, you will need to copy back.
You can find some info about doing that here on StackOverflow.
edit
Put answer to top.
Best Answer
The trick is to load it as a DAE as opposed to a COLLADA. For instance: