-
October 5th, 2004, 03:30 AM
#1
Why do we need DllImport ?
Hi Guys
Besides for reasons which drive us into making API calls, why else would one need to use DllImport ? How different is this from adding a reference to a Library - creating instance of it and then using it ?? Please let me know.
Thanks
Suhaib
-
October 6th, 2004, 03:37 AM
#2
Re: Why do we need DllImport ?
Hi Suhaib,
Besides for reasons which drive us into making API calls, why else would one need to use DllImport ?
There are no other reasons! DllImport is required to identify methods in external "unmanaged" DLLs.
How different is this from adding a reference to a Library - creating instance of it and then using it?
This only works for .NET DLLs.
-
October 7th, 2004, 01:27 AM
#3
Re: Why do we need DllImport ?
You forgot that you can use C++.NET to access unmanaged dlls or COM objects.
Actually, I made the point that it shouldn't exist - it promotes bad practice when people try to take shortcuts by just calling the Win32 functions that they know.
However, it would cripple the language in this respect.
Darwen.
-
October 7th, 2004, 02:44 AM
#4
Re: Why do we need DllImport ?
I know what you mean. Fortunately I do not have a Win32 API or even C++ background, so I only use them as a last resort.
Occasionally though it seems that useful functionality is "missing" from a given component or assembly. A recent example is being able to drag and drop Images cf. ImageList_Drag* API.
Anyone know if Microsoft will be filling the gaps in later releases?
-
October 8th, 2004, 12:45 AM
#5
Re: Why do we need DllImport ?
Anyone tha thas a good tutorial on how to use DllImport?
need to use a C++ dll given by I/O card supplier to be used in C#
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|