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
Arijeet Ghosh
NA
210
37.8k
I have written the code but still comes error
Jul 1 2020 3:19 AM
I have written this code but still can't find the function. Please help me rectify the problem.
The code:-
public
partial
class
Form1 : Form
{
public
Form1()
{
InitializeComponent();
}
private
void
button1_Click(
object
sender, EventArgs e)
{
Test t =
new
Test();
IntPtr fooPtr = Test.plus(5, 7);
int
LENGTH = 0;
var foo =
new
int
[LENGTH];
Marshal.Copy(fooPtr, foo, 0, LENGTH);
MessageBox.Show(LENGTH.ToString());
}
}
internal
sealed
class
Test
{
[DllImport(
"F://test_Multiple//MFCApplication2//Debug//MFCApplication2.exe"
, CharSet = CharSet.Ansi, SetLastError =
true
, ExactSpelling =
true
)]
public
static
extern
IntPtr plus(
int
a,
int
b);
}
Reply
Answers (
2
)
How to get value returned from VC++ function in C#
Marshaling code2 : Problem described below