TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Allan
NA
4
0
Calling an unmanaged C++ DLL with C#
Dec 8 2005 12:18 PM
Fairly newbie question here. I'm using a C++ DLL with a struct definition typedef struct _DEVICE { char DriveName[2048]; char DevicePath[7]; int HostId; int TargetId; }DEVICES; and I want to call the following method int OffLineSDK_GetDeviceList(DEVICES* pDeviceList) In C# code I have as an imort and struct definition using System.Runtime.InteropServices; [StructLayout(LayoutKind.Explicit)] public struct Device { [FieldOffset(0)] public char DriveName; [FieldOffset(2048)] public char DevicePath; [FieldOffset(2052)] public Int32 HostId; [FieldOffset(2056)] public Int32 TargetId; } Am just unsure of how to initialize the proper method call and parameter...something like the following but am unsure of the parameter to create and pass [DllImport("OffLineSDK.dll", CharSet=CharSet.Auto)] private static extern int OffLineSDK_GetDeviceList(...);
Reply
Answers (
0
)
Error while running c# program
ASCII character 1 in C#