-
Notifications
You must be signed in to change notification settings - Fork 414
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
Adding dependencies ordering constraint during linking #172
Conversation
Add additionnal dependencies between libraries, in order to force some ordering during linking. Could be used for fixing missing dependency in an external library, or to control the order of side effects in local libraries (ex: to change some default configuration for specific executables).
Why not fix the library instead?
Do you have an example where this matters? |
It must also be done but in the mean time you have a possible quick fix.
You can look at the test example. If you have a program which is duplicated into two binaries one for the command line and the other graphical. You want to change the behavior of the shared part depending in which binary it is. For example in one case logging can be written on stderr in the other case it must be written in a specific gtk text area. |
It must also be done but in the mean time you have a possible quick fix.
You can also use a patched version temporarily. A missing dependency is a blocker, so a bugfix release of the faulty library should be issued quickly.
I feel like this kind of feature is encouraging people to use dirty workarounds rather than do the right thing and report problems upstream.
You can look at the test example. If you have a program which is duplicated into two binaries one for the command line and the other graphical. You want to change the behavior of the shared part depending in which binary it is. For example in one case logging can be written on stderr in the other case it must be written in a specific gtk text area.
It seems to me that #136 offers a much cleaner solution to this problem.
|
Indeed it is true, or if it is not I at least should try to use it. I'm going to close this MR. But are you interested in 0d91fe7 ? It think it is easier to convince oneself of the correctness with |
Well, it is correct though so it's doing more work for nothing. We could add a helper function to make this clearer: val merge_top_sorted : ('a * 'a list) list -> 'a list |
Add the field
dependencies_ordering
to executable stanza.(dependencies_ordering ((<librarie> <librarie>) ...)
each pair specifies that the first library must be linked before the second one. Both libraries must already appear directly (not in a select) in thelibraries
field. It can be used for fixing missing dependencies in external libraries. More interrestingly it could be used to make sure that the initialization of a library will be executed before the initialisation of another one because of some side effects.