Hello,
I have a library (basically a derived piece of ON_UserData) that I need to compile as dll to use in a RH5 C++ plug-in.
Is this possible? What is the way to do it?
Many thanks,
Pablo
Hello,
I have a library (basically a derived piece of ON_UserData) that I need to compile as dll to use in a RH5 C++ plug-in.
Is this possible? What is the way to do it?
Many thanks,
Pablo
Hi @pagarcia,
I am not sure I understand the question. Can you explain further what you want to to and why?
– Dale
Sure @dale, let me explain: I have developed a derived class from ON_UserData
, let’s call it PabloData
, which plays with OpenNurbs constructs.
A coworker needs to build a Rhino plug-in on top of this class. For certain reasons he cannot access the source code, so I need to compile it into a dll or lib file, such that he can include it in his VC directories. Then he would add the header "PabloData.h"
or the like in his project and be able to instantiate it.
I know how to create binaries out of C++ compilers, but I have no idea about it when including libraries like OpenNurbs in Visual Studio.
Could you give a hint on this? My excuses for being so plain, I’m not a proper software engineer
Thanks,
Pablo
Hi @pagarcia,
Thank you for clarifying.
First, a single plug-in owns user data. That is, when user data is written, the ID of the owning plug-in is written with the data. When Rhino reads user data, it detects the owning plug-in, loads that plug-in, and calls the plug-in to read the data.
That said, it is possible to share user data among two or more plug-in. The following SDK samples demonstrate this:
SampleSharedUserData1
SampleSharedUserData2
Each of these two plug-ins share a common DLL, SampleSharedUserDataCoreLib, which handles the file I/O and the interface into the shared user data.
When you look at the definition of the user data object, CSampleSharedUserData, you’ll see that SampleSharedUserData1
is the owning plug-in.
– Dale
Awesome, thanks @dale . I just wonder, where in the plug-in configuration do you include the PlugInCoreLib.dll and lib?
I see that in stdafx.h
of plug-in 1 and 2 you include the lines
// PlugInCoreLib
#include "..\PlugInCoreLib\PlugInCoreLib.h"
And the dll/lib are physically inside the Release folder. Shouldn’t they in addition be included in the project configuration properties somehow?
Pablo
Hi @pagarcia,
All of the magic is in SampleSharedUserDataCoreLib.h, which is included in both the the plug-in projects I mentioned above.
– Dale