Use this tutorial to learn how to set up and run the Sample HyperX Analysis Plugin Package. You can download the final source code for this Sample Plugin from here.
It is highly recommended to use Microsoft Visual C++, although other compilers are also supported (see Compiler Support). This tutorial will be using Microsoft Visual C++. For help installing Visual C++ 2017 (or MinGW-w64 with Eclipse - not recommended), see Compiler Notes - System Requirements.
-
Open Visual Studio.
-
Ensure that the Desktop Development with C++ workload is installed under Tools | Get Tools and Features.
-
On the Start Page click New Project.
-
In the "Installed" frame, select Visual C++ | Windows Desktop | Windows Desktop Wizard.
-
Set the project and solution names to e.g. "Hs_Sample" and "Sample", respectively (any names can be used). Optionally, change the solution folder location if desired.
-
Click Create.
-
Select Dynamic Link Library (.dll) from the application type dropdown, enable Empty Project, and disable Precompiled Header. If you are using VS 2019, the option to enable SDL checks is not available on the project form - this is fine, and should not have any impact on successfully importing the Sample Plugin.
-
Click OK.
-
Copy/download the source code from the installation directory. E.g.: $(InstallDirectory)\Code\AnalysisPlugins_V{VERSION_NUMBER}.zip.
-
Unzip the folder.
-
Copy and paste all of the C++ source files (*.cpp, *.h) into the project directory, e.g.
C:\HS-Plugins\Sample\Hs_Sample
-
Copy and paste the plugin API folder (e.g. hs_7_3_53) into the solution directory, e.g.
C:\HS-Plugins\Sample Plugin
-
Return to Visual Studio. In the Solution Explorer right-click the project and select Add | Existing Item.
-
Add all the *.cpp and *.h files in the project directory. Click OK.
Important
Do not add any files from the hs_#_#_# folder.
-
The project files should be similar to the following. The default filters "Header Files", "Resource Files" and "Source Files" were deleted and manual filters "Core Analysis Code" and "HS Interface" were added. Modifying the filters is optional.
-
In case of using source control, you will need to manually add the Plugin API files to source control.
The HyperX Plugin API must be included by the compiler.
-
In the Solution Explorer, right-click the project name and select Properties.
-
Select "All Configurations" from the Configuration: drop-down menu.
-
In the settings tree browse to Configuration Properties | C/C++ | General.
-
Set the include directory to corresponding hs_#_#_# folder. Here we are using the $(SolutionDir) macro to specify that we are using the solution directory.
$(Solution_Dir)hs_7_3_53
-
Click OK.
Here we will statically link to the C++ runtime to remove library dependencies when distributing the DLL to other users. See Library Dependencies. In addition to that, we will set the compiler up to be more strict about warnings to catch potential errors during compile time, instead of at runtime.
Tip
These steps are recommended to write more portable, safer code. However, they are not required by the Plugin API. If you need to link to an external library with different settings, you do not need to follow these steps.
-
Right-click the project name in the solution explorer and select Properties.
-
Set the Configuration to "Release".
-
In Configuration Properties | C/C++ | Code Generation| Runtime Library set the value to:
Multi-threaded /MT -
Click Apply.
-
(Optional) In Debug mode, the equivalent option is:
Multi-threaded Debug /MTdUsing
/MTdmay reduce the amount of data that the debugger can display. Therefore, using this option is not recommended. -
The settings for warnings can be found under Configuration Properties | C/C++ | General. The following settings are recommended. Note that they are set for both Release and Debug modes.
-
If compiling for an API version greater than or equal to 8.0.58, the language standard must be set to C++17. Navigate to Configuration Properties | General | C++ Language Standard and set the C++ Language Standard to ISO C++17 Standard (/std:c++17)
The DLL has to be compiled using the 64-bit build configuration.
-
In the Solution Platforms drop-down, select "x64".
Tip
It is recommended to delete the x86 (32-bit) configuration in the Configuration Manager dialog to avoid confusion. Select "Edit" in the "Active solution platform:" drop-down menu. Similarly, select "Edit" in the "Platform" dropdown menu for the Hs_Sample project (also in the Configuration Manager).
In order to automatically install Hs_Sample.dll in the proper folder, we can set a post-build event to copy the DLL from the solution folder to whichever folder we desire.
-
Right-click the project name in the solution explorer and select Properties.
-
Set the Configuration to "All Configurations" and the Platform to "x64".
-
In Configuration Properties | Build Events | Post-Build Event | Command Line, enter the following macro:
xcopy "$(OutDir)$(TargetName).dll" "C:\HyperX\Plugins\Sample\" /YNote
Remember to use quotes. Remember to end the target directory with a slash so that a new directory is created if necessary. The
/Yparameter suppresses the overwrite prompt when copying the file. -
Click OK.
Before testing the DLL in HyperX, you can verify that the proper methods are exposed by following the steps outlined in DLL Exports, Dependencies and Symbols.
Note
If the Sample Plugin loads into HyperX and runs without error, this step is not necessary.
-
Select Plugins from the Analysis tab of the Ribbon.
-
On the proceeding Plugin form, browse to the Plugin Package DLL file by clicking the ellipsis or Add button.
If the configuration passes validation, you will see configuration data for the Package, Plugins, and Analysis Settings.
Note
Multiple Plugin Packages can be installed by clicking Add.
-
Click OK. The Plugin Package configuration data is installed in the Database.
-
Create a Failure Mode for this Plugin Package and add it to an Analysis Property.
-
Activate the user defined analyses for the skin and stringer segments. See Viewing Plugin Results.
-
Analyze the Structure. View results in the Analysis Watch Window.
The Plugin can be debugged interactively by pointing the Visual Studio debugger to the main HyperX Sizing Executable and the HyperX Project input file.
-
In the Solution Explorer, right-click the Plugin Project and select Properties.
-
Make sure that the configuration is set to Debug.
-
In Configuration Properties | Debugging, set the command and command arguments fields.
Note
Make note of the quotes surrounding the command arguments and the lack of quotes in the command.
-
Command:
$(InstallationDirectory)\Executable\Hs_V205.exeNote
Do not surround with quotes.
-
Command Arguments:
“[ProjectWorkingFolder]\Input\InputData.INI”Note
Remember to surround the command argument with quotes.
-
[ProjectWorkingFolder]: The name of the folder containing the active project -
C:\HyperX\Projects\Tempis the default HyperX Project working folder base path. The location of the folder may vary depending on your installation location.Tip
You can quickly find your Project working folder by using ”Database | Project | Open Project Working Folder" function from the Database tab of the Ribbon.
-
The C++ settings are shown below.
Note
This screenshot assumes that the project name is "SamplePluginDemo".
-
-
Set a breakpoint in the
HsAnalysis.cppsource file by left-clicking in the left margin. -
Press F5 to begin debugging, or click the green "Local Windows Debugger" in the top middle of Visual Studio.
-
Check the spelling of the command and the command arguments. You can run the
Hs_V205.exein the command line to verify the spelling.-
In the project properties, be sure that the command field is not surrounded by quotes.
-
In the project properties, be sure that the command arguments field is surrounded by quotes.
-
-
Be sure that you have previously Analyzed the Structure with panel user analyses active. This will write the proper input file (
*.ini) for the HyperX Sizing Executable.
-
-
View the Local Variables window using Debug | Windows | Locals. You can add a variable to the Watch window by right-clicking a variable in the source code and selecting Add Watch.