Sam Hobbs

Sam Hobbs

  • 51
  • 29.3k
  • 2.1m

DLL files

Mar 1 2012 4:34 AM
I occasionally see questions about DLL files. Sometimes a question asks how to use a DLL file and sometimes they ask how to make them.

It is my advice to always get clarification of what type of DLL. There are many types of DLLs. There are native DLLs and there are DLL files that have a type library (COM object or something like that) and there are .Net Class Libraries.

If the question is asking about using a DLL file that is a native DLL file and the suggestion is to make a reference to the DLL file, then the suggestion will not work. If the question is asking about a COM object or other type of DLL that has a type library or if it is a .Net Class Libraryand the suggestion is to use Platform Invoke (DllImport) then the suggestion will not work.

If the question is asking how to make a native DLL then that cannot be done using C#. I am not sure whether it is possible to create a COM object type of DLL using C# but if it is possible then it sure is not as easy as simply creating a .Net Class Library.

I think it is a mistake to not ask for clarification of questions such as that before tryng to help. Developers should know to be specific. I totally understand if the person asking the question does not know what to specify but whether they do or they do not, when we try to help we should first get clarification. If we try to guess and we guess wrong then it is a waste of time for everyone.