Giter VIP home page Giter VIP logo

Comments (3)

chrbertsch avatar chrbertsch commented on August 24, 2024

TorstenS: If you do not take a copy of the function pointers, you can run into trouble.
Andreas: "The struct contains pointers to functions provided by the environment to be used by the
FMU. It is not allowed to change these functions between fmi2Instantiate(..) and
fmi2Terminate(..) calls."
TorstenS: My question was: can one keep a pointer to the struct?
Andreas: Maybe it is not specified (I found it for strings)
TorstenS: Should we define pointers are only valid for the call?
Andreas: Anything that points into memory of the importer ... (not logging).
Andreas, TorstenS: We have to think this through more carefully. And perhaps mandate what is best practice.

from fmi-standard.

HansOlsson avatar HansOlsson commented on August 24, 2024

The current text makes little sense.

C does not allow a function to change - whereas function pointers are often changed, so a sensible interpretation is that when it says "It is not allowed to change these functions between fmi2Instantiate(..) and fmi2Terminate(..) calls." the intent was "It is not allowed to change these functions pointers between fmi2Instantiate(..) and fmi2Terminate(..) calls." which means that the pointed to struct cannot be changed by the caller - in that case it doesn't matter if the FMI makes a copy of the function pointers or not; as the values cannot change.

If we only wanted that the struct should be valid during the call we could have sent in a struct instead of a pointer to struct (the overhead of sending a struct by value during instantiation is minimal).

from fmi-standard.

chrbertsch avatar chrbertsch commented on August 24, 2024

Fixed with #1931

from fmi-standard.

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.