Grasshopper

algorithmic modeling for Rhino

I am almost there on getting a Component working. I am having issues with an error thrown by the following code:

//C# Original

        public override GH_Exposure Exposure
        {
            get { return GH_Exposure.primary; }
        }

This gets Converted to C++/CLI to look like

//.h file code:

    public:
        property GH_Exposure ^Exposure
        {
            virtual GH_Exposure ^get() override;
        }

//.cpp file code:

GH_Exposure ^<missing_class_definition>::Exposure::get()
{
    return GH_Exposure::primary;
}

On build time it returns the error

'Grasshopper::Kernel::GH_Exposure ^MyProject1::MyProject1Component::Exposure::get(void)': overriding virtual function return type differs from 'Grasshopper::Kernel::GH_Exposure Grasshopper::Kernel::GH_DocumentObject::Exposure::get(void)'  

Any thoughts or help on this would be fantastic.

Views: 578

Replies to This Discussion

I have no idea about C++/CLI but ^<missing_class_definition> does not look like it should compile.

    GH_Exposure *Exposure::getExposure() const
    {
        return GH_Exposure::primary;
    }

Is what it should read. Thanks for the attempt at solving the obvious one. But always appreciated.

*** The purpose of this component, as I could just throw together a C# component, is to to save myself extra coding down the pipeline. I'm trying to eventually pass calculations to GPU Kernels.

I could set up a three way street where I make the call from C# to a .dll set up for CUDA operations. But If I could get away from needing the C# altogether it would be an avenue Id be willing to explore.

If I get rid of the the Exposure code along with the bitmap call its using then it compiles, but..... then the component cannot be called from grasshopper.

I have no idea. My only thought is that C++/CLI is a monster of a language and we no longer use it at McNeel. Instead we have separate projects (one C++, the other C#) and PInvoke between them.

You can ask on our Discourse forum, the few people at McNeel who've actually used CLI at some point hang out there.

Yeah the last week of research on the topic has led to the conclusion you brought forth above. Ill give it a go on the forum and see if anyone has more insight on it. My backup plan was to try the PInvoke method. It seemed the CLI method was the lesser of two evils at the moment of action.

Thanks for the help!

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service