Rhino Dependent C++ DLL


I am trying to collect some of my functions and classes (which I tend to reuse) and put them in a single DLL which I can then use in my plug-ins. So far I have not been completely successful. I would appreciate some help with this. You can find a very simple VS2010 C++ example here (which is based on the Moose example) and bellow I pointed out what I did and what doesn`t work:

testcallpalib.zip (1.8 MB)

(Here is it again if the attachment didnt work
https://drive.google.com/file/d/0B-30e0YjksYfdHFrTXJiZnpGS2s/view?usp=sharing )

  1. The Preprocessor definition PA_DLL_EXPORTS is defined in the pa_lib project properties

  2. pa_lib_LinkingPragmas.h is done based on the Mosse example

  3. I put all definitions (PA_CPP_FUNCTION etc…) at the end of the stdafx.h in the pa_lib project (so they can be accessible from everywhere)

  4. In the testcallpalib project, in the stdafx.h I included:
    #include “…/pa_lib/pa_functions.h”
    #include “…/pa_lib/pa_myclass.h”

  5. Finally in the cmdtestcallpalib I do something like this:
    ON_3dPoint pt = PA_SelectPoint(L"select a point");
    CPA_MyClass myclass;

After this setup - everything compiles fine. However, if I try to load the plug-in I get the following message: Plug-in commands must pass a pointer to their parent plug-in…(image bellow)

If I simply comment out the call to the PA_SelectPoint function in the cmdtestcallpalib, the plug-in will load normally…but that doesnt help much.

So my questions are:

  1. Why is that message there? How can I avoid it and get the functions to work.
  2. Is the rest of the setup ok? Especially for the class? I would really like for this to work for functions and classes…
    (3. the next step would be to somehow only link the DLL if it is possible, and not insert the entire pa_lib project in the solution, but one step at the time…)

Solution for this would mean very much to me…thanks a lot!


Hi @dimcic,

If this truly is a Rhino-dependent DLL, then it should not contain a plug-in class definition and any Rhino commands.

– Dale

Thanks Dale,

that was easy. In the example I`ve sent the library and the project using it are the part of the same solution. Any quick tip/advice on how to use a DLL that has been separately built? Is there any “catch” to it?


Hi @dimcic,

If you want to use a C++ Rhino-dependent DLL in multiple plug-in projects, then you will need:

1.) The DLL
2.) The import library (.LIB)
3.) One or more .h files that define the exports of the DLL.

In the Moose sample:


The Moose plug-in project is a consumer of MooseCoreLib, which is a Rhino-dependent DLL. If you study the Moose plug-in’s stdafx.h file, you will see how this project references the DLL.

– Dale