Name callback data structs#2625
Conversation
This allows to forward-declare callback data types in case a callback needs to be declared in a public header: struct _HighsCallbackDataOut; struct _HighsCallbackDataIn; typedef _HighsCallbackDataOut HighsCallbackDataOut; typedef _HighsCallbackDataIn HighsCallbackDataIn;
Structs don't have a leading "_" in HiGHS
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## latest #2625 +/- ##
==========================================
+ Coverage 81.06% 81.08% +0.01%
==========================================
Files 347 347
Lines 85219 85313 +94
==========================================
+ Hits 69083 69176 +93
- Misses 16136 16137 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@jschueller Would without allow forward-declaring as well? Could you give us an example of the code you need to build, if possible? If you define another HighsCallbackDataOut would that not be an issue? |
|
no, that wouldnt work (error: conflicting declaration ‘typedef struct HighsCallbackDataOut HighsCallbackDataOut’) here is what I'm trying to do in a nutshell: Solver.hxx: Solver.cxx: |
|
I tried this minimal example locally, and, with the HiGHS code from latest, simply declaring the struct compiled as well: Solver.hxx and This way you still include |
|
yes, I still get a conflicting declaration with your solution I prepared a repo to replicate the issue, see the github actions logs: |
|
hello @galabovaa, any new thoughts on this ? |
|
I have not had a chance to investigate properly yet. Some of us were at a conference and we have some new developments to complete. We will likely accept this, I just need to try it out myself first |
Rationale: this allows to forward-declare callback data types in case a callback needs to be declared in a public header:
struct _HighsCallbackDataOut;
struct _HighsCallbackDataIn;
typedef _HighsCallbackDataOut HighsCallbackDataOut; typedef _HighsCallbackDataIn HighsCallbackDataIn;