Fatal error condition... channel_bootstrap.c:743: bootstrap
Debugging and Documentation Question
#570
-
Hello, I have a question about a specific issue I don't understand that connects to a more general debugging question. I have written a C++ class
When run, this code hits a fatal error in the
I suspected this was related to the scope or lifecycle of the Working version:
Similarly, I could use a default constructor and rename I have found the documentation in the Developer Guide great for understanding general Greengrass concepts and getting simple C++ programs up and running by replicating the examples. But is there a better source for detailed explanations on how to use the C++ API and its nuances? I don't see anything about |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
It's not quite that things need to be local, it's that if you're building something and passing in a reference to an object, then that object needs to outlive what you're building. The samples tend to put everything in a quasi-global (main) scope for simplicity. But unfortunately, given a C++ environment, you need to always be thinking about object lifetimes. Personally, I wish we'd never allowed by-value construction of complex objects (bootstrap, event loop group, etc..) and only allowed shared_ptr-returning-factory construction and everything configured by shared pointers not direct references. I think the semantics would have been much clearer and safer to use, but unfortunately, that's not the API we have. |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
It's not quite that things need to be local, it's that if you're building something and passing in a reference to an object, then that object needs to outlive what you're building. The samples tend to put everything in a quasi-global (main) scope for simplicity. But unfortunately, given a C++ environment, you need to always be thinking about object lifetimes.
Personally, I wish we'd never allowed by-value construction of complex objects (bootstrap, event loop group, etc..) and only allowed shared_ptr-returning-factory construction and everything configured by shared pointers not direct references. I think the semantics would have been much clearer and safer to use, but unfortunately, that…