DLL we need to specify where is the header file of this dynamic library.įrom Visual Studio > Right click your badprog-executable project > Properties > Configuration Properties > C/C++ > General > Additional Include Directories > Add the following path: Same for the Project contexts (below in the same window of the Configuraiton Manager). DLL.įor that from Visual Studio > Build > Configuration Manager... > Be sure that Active solution platform is set to 圆4. So from another instance of Visual Studio > File > New Project... > Installed > Visual C++ > Windows Desktop > Windows Console Application.Īt this point, be sure that your configuration is exactly the same as the. We're going now to create our executable project that'll use this dynamic library.
OK, if you try to compile this project it'll work.īut of course, if you try to run it, it won' t. There is also a new file added automatically by Visual Studio in your explorer: You can ride of the badprog-dynamic-library.cpp file. Let's add a new class, from Visual Studio > Right click your badprog-dynamic-library project > Add Class... > And write the following: You should see the BADPROGDYNAMICLIBRARY_EXPORTS define. You can see this in > Right click your badprog-dynamic-library project > Properties > Configuration Properties > C/C++ > Preprocessor > Preprocessor Definitions. Once created, the Preprocessor gained a new #define:
#Make a dll file .dll#
DLL in a 圆4 version, so we'll have to use it with a 圆4-executable version as well. Important note: We are going to create a. It's an easy tutorial so even if you are a beginner this example will help you. We'are going to create a dynamic-link library, at first, then create an application that'll use this library. We need of course Visual Studio 2017 but feel free to use the version of your choice. No need to say that we'll use Visual Studio for that. DLL is an interesting process that allows a better comprehension how a dynamic-link library works on Windows.