How do you directly call a native function exported from a
DLL?

Answers were Sorted based on User's Feedback



How do you directly call a native function exported from a DLL?..

Answer / santhanakumar

HERE IS THE CODE EXAMPLE :

using System.Runtime.InteropServices; \
class C
{
[DllImport("user32.dll")]
public static extern int MessageBoxA(int h, string
m, string c, int type);
public static int Main()
{
return MessageBoxA(0, “Hello
World!”, “Caption”, 0);
}
}

Is This Answer Correct ?    3 Yes 0 No

How do you directly call a native function exported from a DLL?..

Answer / moghan

Yes we can call a native function exported from a Dll in
the following way,
I used C#.Net for Coding.

Add a Namespace that "System.Runtime.InteropServices"

Then use the following code,

Syntax:
[DllImport("dllname")]
here place the function in "dllname" Dll.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More Dot Net Remoting Interview Questions

What?s Singleton activation mode?

3 Answers  


What is the difference between private and shared assembly?

1 Answers  


What is the difference beween the registeractivatedservicetype() and registeractivatedclienttype()?

0 Answers  


What is the purpose of strong name?

0 Answers  


What is boxing and unboxing ?

4 Answers   Amdocs, BirlaSoft, TCS,






What technology enables out-of-proc communication in .NET ?

1 Answers  


What?s a Windows process?

1 Answers  


What are remotable objects in .NET Remoting?

2 Answers  


What is unmanaged code?

0 Answers  


About remoting and web services. Difference between them?

6 Answers   Microsoft,


What are possible implementations of distributed applications in .NET?

2 Answers  


What is unboxing?

0 Answers  


Categories