Every now and then, the question about how to create a Rhino-dependent C++ DLL comes up.
A Rhino-dependent C++ DLL is one that links with Rhino C++ SDK libraries, and that can be used to add functionality that can be shared between multiple C++ plug-ins, or that can be used to add Platform Invoke (PInvoke), interop functionality to RhinoCommon or Grasshopper plug-ins.
There are the simple steps for building a Rhino-dependent C++ DLL.
-
Download and install the Rhino C/C++ SDK per these instructions.
-
Create a Rhino C/C++ plug-in project per these instructions.
-
In Visual Studio - Solution Explorer, delete the plugin
.cpp
and.h
files, and delete the command.cpp
file. -
In Visual Studio - Property Manager, remove the
Rhino.Cpp.PlugIn
property page from both theDebug|x64
and theRelease|x64
build configurations. -
Again in Visual Studio - Property Manager, add the
Rhino.Cpp.PlugInComponent.props
property page to both theDebug|x64
and theRelease|x64
build configurations. This property page are found in the PropertySheets folder in the Rhino C++ SDK folder.
Done - you now have a Rhino-dependent DLL project. Now you are ready to add your functionality; either by adding or linking in other libraries, or by exporting custom C++ functions.
Additional information:
Rhino 6 C++ Creating a Library
Step-by-step example for adding C++ DLL to a Python script
– Dale