Steps to create a simple ATL DLL using the VS2005 AppWizard...
-
I found an article on CP, "How to write a Super compact Super Fast C++ Dll for Visual Basic" which explains how to use ATL to create a DLL. When I use the VS 2005 AppWizard to create an ATL DLL, it ends up creating a lot more files in the Solution Explorer than are present in the sample project from the article I mention. For example, after using the AppWizard I end up with the following in the Solution Explorer Treeview: http://img130.imageshack.us/img130/5752/testatldllsolutionexplorer1hn.png[^] whereas the sample project only has the following in the Solution Explorer Treeview: http://img442.imageshack.us/img442/7792/tvb4jn.png[^] I'm guessing the difference is probably because the sample file project was created in VC++ 6. In the example project, the automatically created functions: DllCanUnloadNow DllGetClassObject DllRegisterServer DllUnregisterServer have been commented out in tvb.cpp and the entries removed from tvb.def, but in the VS 2005 project they are not commented out and the entries are still in the .def file. The sample project also has the following line commented out in tvb.idl: //import "ocidl.idl" What does this line do, and what does the line import "oaidl.idl" do ? All I want to do is create a DLL which exports my own functions. For example, AddTwoInts(int a, int b). 1) Of the automatically generated files from the VS 2005 ATL AppWizard, what can be safely deleted ? 2) Once that's done, do I only need to add the following to the end of ATL_Test_DLL.cpp extern "C" { int__stdcall AddTwoInts( int a, int b ) { return( a + b ); } } followed by adding the following to the end (ie. after the line with "EXPORTS") of ATL_Test_DLL.def AddTwoInts Do I need to do anything else ?