Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- long func(struct name * myname)
- {
- strcpy(myname->firstname,"rakesh");
- strcpy(myname->lastname,"agarwal");
- return S_OK;
- }
- struct name
- {
- char firstname[100];
- char lastname[100];
- }
- [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
- unsafe public struct name
- {
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst=100)]
- public string firstname;
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)]
- public string lastname;
- } ;
- [DllImport("C++Dll.dll")]
- public unsafe static extern long func(name[] myname);
- name[] myname = new name[1];
- func(myname);
- name myname = new name();
- func(ref myname);
- [DllImport("C++Dll.dll")]
- public unsafe static extern long func(ref name myname);
Add Comment
Please, Sign In to add comment