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
branimir.cace
NA
2
0
Passing arrays
Feb 23 2004 4:38 AM
I found out that I can make an array in the C# exe and pass it as a parameter to a dll fuction. When the function is done, array members are changed so I don't need to send anything back to the exe. The only problem is that it doesn't work for two-dimensional arrays. I tried it and the compiler showed no errors, but at debug the message magically appeared: "Object reference not set to an instance of an object". Here's what I did: C# exe: [DllImport("ZdravoDll.dll")] public static extern void DllFunction(int[,] nesto); int[,] field=new int[301, 301]; ... ... DllFunction(field); ... ------------------------------------------ C++ dll: void DllFunction(int *polje[])//or polje[301][301], the result is the same { ... } I'm beginning to think that it can't be done. MarshalAs attribute doesn't have an unmanaged type for a two-dimensional array. LPArray is for one-dimensional arrays only (if I understood it correctly). Anyway, if anyone knows ANYTHING about this, please reply!
Reply
Answers (
0
)
how to prevent performing or copying executive files
problem creating object of main class