Coder Social home page Coder Social logo

Comments (5)

ltaylor16 avatar ltaylor16 commented on May 13, 2024

Shroud automatically creates a getter and setter method for the C++ object which is shadowed by the derived type. The default names are 'get_instance' and 'set_instance'. The C++ name getInstance is changed to get_instance for Fortran by default (since Fortran is not case sensitive). The name conflicts and the compiler complains. The easiest work around is to suppress the creation of the getter and setter by setting their names to blank use a format block on the class:

- decl: class ResourceManager
  format:
     F_name_instance_get:
     F_name_instance_set:

You can also explicitly name them something else if you want to keep them. The other option is to change the name of the Fortran wrapper for getInstance to something else using a format block on the method:

- decl: static ResourceManager& getInstance()
  format:
    F_name_impl: non_conflicting_name

from shroud.

davidbeckingsale avatar davidbeckingsale commented on May 13, 2024

Thanks! Are there any side effects from disabling the getter/setters?

from shroud.

ltaylor16 avatar ltaylor16 commented on May 13, 2024

Not really. A typical user should not need access to the raw C++ pointer.

from shroud.

davidbeckingsale avatar davidbeckingsale commented on May 13, 2024

Perfect, I will give that try. I think I tried using F_name_impl before and something was still amiss, but maybe it did work.

In any case, it's nice to able to have the names match across C++/C/Fortran. Thanks again.

from shroud.

davidbeckingsale avatar davidbeckingsale commented on May 13, 2024

Suppressing the getter/setter creation worked, closing.

from shroud.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.