Rhino 6 C++ Creating a Library

Hi,

I am in the process of transitioning to Rhino 6 and one of the things is transferring some libraries. Following the Moose example (https://github.com/dalefugier/Moose) I was able before to create a C++ Library that could be used in other projects (C++ and C# projects)…Trying to do the same now doesn’t work. The plug-in that calls some function from the library cannot get loaded…it always gives the same message: Unable to load test.rhp plug-in: Dependent DLL is out of date. I tried this twice, on two separate computers…

I uploaded an example with both the library project and the plug-in project here:

https://drive.google.com/file/d/1BWydB1AUvVI8NSSuV3vKf2vp7Vb2zLB1/view?usp=sharing

I am hoping for a short fix and that I am probably missing something obvious - but for the long run I guess it would be the best to update the Moose example…?

Thanks!

Hi @dimcic,

Attached is how I normally structure a C++ solution that plugins that reference DLLs. Please study carefully.

SampleSharedLibrary.zip (77.3 KB)

Let me know of you have any questions.

– Dale

Hi Dale,

thank you for the example. I see that there are differences compared to the “old way” but it didnt help me yet…I adjusted my examples to fit yours and I am still getting the DLL is out of date…and the problem is that my libraries actually include Rhino Functions and Classes…so I cannot delete all the things that you deteled in stdafx.h of the Library… I notice you deleted #define RHINO_V&_READY…the Rhino SDK Preamble…RhinoSdk.h,…Rhino SDK linking pragmas…etc…

So my guess is that my “DLL is out of date” problem is “hidden” there somewhere… could you maybe expand your example by including RhinoSDK…with a function that maybe adds two ON_3dVector instead of adding two numbers? Then I will maybe be able to realize where the problem is…

Thanks!

Hi @dimcic,

See the following:

SampleSharedRhinoLibrary.zip (99.4 KB)

In this solution, the SharedLibrary project was created by first creating a new Rhino 6 C++ plugin project.

I then removed the plugin .cpp and .h files and the command .cpp file.

Finally, I removed the Rhino.Cpp.PlugIn.props property page and added the Rhino.Cpp.PlugInComponent.props. These property pages are found in the PropertySheets folder in the Rhino C++ SDK folder. Use Visual Studio’s Property Manager to do this.

Of course, I also added the SAMPLELIBRARY_DLL_EXPORTS processor definition to this project only.

Let me know if this helps.

– Dale

Yes, it worked! Thanks!

I guess that the secret was in the Rhino.Cpp.PlugInComponent properties…because that is the only thing I did not do before…That being solved, we will go to the next hurdle :slight_smile: I saw that the Conduit behaves a bit diferently…but I will start another thread with a concrete question…