How do you directly call a native function exported from a
DLL?
Answers were Sorted based on User's Feedback
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 |
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 |
What are the difference between static assemblies and dynamic assemblies?
What is ODP.NET?
Can you configure a .NET Remoting object via XML file?
1 Answers Tavant Technologies,
About remoting and web services. Difference between them?
Explain the differences between marshal by value and marshal by reference?
What is an assembly and what does manifest consists ?
What?s SingleCall activation mode used for?
What are possible implementations of distributed applications in .NET?
What are the different types of channels used by .net remoting and which is the best one?
Explain how to perform remoting?
How does assembly versioning in .NET prevent DLL Hell?
3 Answers Satyam, Siebel Systems,
About performance issues on retrieving records ?