-
Notifications
You must be signed in to change notification settings - Fork 267
Name callback data structs #2625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: latest
Are you sure you want to change the base?
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: |
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;