Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
- public struct UserProfileData
- {
- int userProfileRevision;
- [MarshalAs(UnmanagedType.LPStr)]
- public String firstName;
- [MarshalAs(UnmanagedType.LPStr)]
- public String lastName;
- [MarshalAs(UnmanagedType.LPStr)]
- public String memberids;
- [MarshalAs(UnmanagedType.LPStr)]
- public String emailAddress;
- }
- typedef struct userProfile
- {
- int profileRevision;
- char *firstName;
- char *lastName;
- char *memberids;
- char *emailAddress;
- } userProfile_t;
- int getUserProfileData(userProfile_t *pUserProfile);
- [StructLayout(LayoutKind.Sequential)]
- public struct UserProfileData
- {
- int userProfileRevision;
- public IntPtr firstName;
- public IntPtr lastName;
- public IntPtr memberids;
- public IntPtr emailAddress;
- }
- [DllImport(@"mydll.dll", CallingConvention=CallingConvention.???)]
- private static extern int getUserProfileData(out UserProfileData userProfile);
- string firstName = Marshal.PtrToStringAnsi(userProfile.firstName);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement