MathLibrary and MathClient projects in MS Visual Studio 2022

Home and Applets > Download SVD-GPU Application Source Code > MathLibrary and MathClient Projects in MS Visual Studio 2022

Two projects from Microsoft (Reference 1) are presented. MathLibrary project generates a DLL file and a LIB file that are used by MathClient project. DLLs are linked into a program at run time instead of build time.
Both Visual Studio 2022 projects contain cpp files in Windows 11 environment. CUDA is not involved.

The Visual Studio 2022 project folder:
C:\Users\pm\source\repos

*** Outline ***

  1. MathLibrary project in MS Visual Studio 2022
  2. MathClient project in MS Visual Studio 2022
  3. References

MathLibrary project in MS Visual Studio 2022

  1. Launch Visual Studio 2022. In Get started sub-panel, click Open a new project.
  2. In Create a new project panel, select DLL (Universal Windows).

    Click Next button.
  3. In Configure your new project panel:
    Provid the name of the Project name: MathLibrary

    Click Create button.
  4. The Visual Studio editor appears with a dllmain.cpp file.

    Four files are generated: dllmain.cpp, pch.cpp, pch.h, and framework.h
  5. These four files are located in:
    C:\Users\pm\source\repos\MathLibrary\MathLibrary

  6. Right-click the folder of Header Files in Solution Explorer.
    Select Add then New Item...
    Add New Item - MathLibrary panel appears.
    Select Header File (.h).
    Provide the Name: MathLibrary.h

    Click Add button.
  7. Open MathLibrary.h from Reference 1. Copy and paste its content into the source file MathLibrary.h.
  8. Right-click the folder of Source Files in Solution Explorer.
    Select Add then New Item...
    Add New Item - MathLibrary panel appears.
    Select C++ File (.cpp).
    Provide the Name: MathLibrary.cpp

    Click Add button.
  9. Open MathLibrary.cpp from Reference 1. Copy and paste its content into the source file MathLibrary.cpp.
  10. Right click the file MathLibrary.cpp in Solution Explorer. Select Properties.
    The Item Type is C/C++ compiler. Close the panel.
  11. Right click the file MathLibrary.h in Solution Explorer. Select Properties.
    The Item Type is C/C++ header. Close the panel.
  12. Select Build menu then Build Solution.

  13. The MathLibrary project folder contains:



    The files MathLibrary.dll and MathLibrary.lib are generated in the folder:
    C:\Users\pm\source\repos\MathLibrary\x64\Debug

MathClient project in MS Visual Studio 2022

  1. Launch Visual Studio 2022.
    In Get started sub-panel, click Create a new project.
  2. In Create a new project panel, select Console App.

    Click Next button.
  3. In Configure your new project panel, provid the name of the project: MathClient

    Click Create button.
  4. The Visual Studio editor appears.

  5. The Visual Studio 2022 project folder contains two folders:

  6. Open MathClient.cpp from Reference 1. Copy and paste its content into the source file MathClient.cpp.
  7. *********************************************
    Add MathLibrary.h to MathClient project
    *********************************************
  8. Right click the project MathClient in Solution Explorer. Select Properties.
    MathClient Property Pages appears.
    Select C/C++ then General.
    Add ..\..\MathLibrary\MathLibrary in Additional Include Directories.

    Click Apply button then OK button.
  9. **************************************************************
    Add MathLibrary.lib and its folder to MathClient project
    **************************************************************
  10. Right click the project MathClient in Solution Explorer. Select Properties.
    MathClient Property Pages appears.
    Select Linker then Input.
    Add MathLibrary.lib; in Additional Dependencies.

    Click Apply button then OK button.
  11. Right click the project MathClient in Solution Explorer. Select Properties.
    MathClient Property Pages appears.
    Select Linker then General.
    Add ..\..\MathLibrary\$(IntDir) in Additional Library Directories.

    Click Apply button then OK button.
  12. ******************************************************
    Copy MathLibrary.dll from its MathLibrary folder
    into MathClient project
    ******************************************************
  13. Right click the project MathClient in Solution Explorer. Select Properties.
    MathClient Property Pages appears.
    Select Build Events then Post-Build Event.
    Add xcopy /y /d "..\..\MathLibrary\$(IntDir)MathLibrary.dll" "$(OutDir)" in Command Line.

    Click Apply button then OK button.
  14. Select Debug menu then Start Without Debugging

  15. Visual Studio 2022 editor looks like:

  16. The MathClient project folder contains:



References

  1. Microsoft: Walkthrough: Create and use your own Dynamic Link Library (C++) with Visual Studio 2022
  2. National Instruments: Building a DLL with Visual C++
  3. wikiHow: How to create DLL files

Solid-state NMR bibliography for:

Aluminum-27
Antimony-121/123
Arsenic-75
Barium-135/137
Beryllium-9
Bismuth-209
Boron-11
Bromine-79/81
Calcium-43
Cesium-133
Chlorine-35/37
Chromium-53
Cobalt-59
Copper-63/65
Deuterium-2
Gallium-69/71
Germanium-73
Gold-197
Hafnium-177/179
Indium-113/115
Iodine-127
Iridium-191/193
Krypton-83
Lanthanum-139
Lithium-7
Magnesium-25
Manganese-55
Mercury-201
Molybdenum-95/97
Neon-21
Nickel-61
Niobium-93
Nitrogen-14
Osmium-189
Oxygen-17
Palladium-105
Potassium-39/41
Rhenium-185/187
Rubidium-85/87
Ruthenium-99/101
Scandium-45
Sodium-23
Strontium-87
Sulfur-33
Tantalum-181
Titanium-47/49
Vanadium-51
Xenon-131
Zinc-67
Zirconium-91
[Contact me] - Last updated November 18, 2024
Copyright © 2002-2024 pascal-man.com. All rights reserved.