ocaml / flexdll

a dlopen-like API for Windows
Other
97 stars 30 forks source link

"flexlink -install" to compile its own runtime objects #46

Open alainfrisch opened 6 years ago

alainfrisch commented 6 years ago

As discussed with @dra27, the idea is to let flexlink creates its own object files (flexdll{initer,}CHAIN.{obj,o}`). The following options are added to flexink:

@dra27 : please comment!

dra27 commented 6 years ago

The principle behind this looks fine, though it would at present break bootstrapping flexdll in OCaml. It's only a small piece of duplication, but it would be better for the Makefile still to build the C objects "by hand" (since this is what the OCaml flexdll target does and is also what the opam flexdll package will do). That would leave flexlink -install as the recommended way for building OCaml when you download a binary distribution, while also allowing the possibility of building without any binary tools to begin with.

Would you be happy to defer this until after 4.06.0 (so release 0.37 now)? The other thoughts I have:

alainfrisch commented 6 years ago

All good points, thanks! Delaying to after 0.37.

alainfrisch commented 6 years ago

I still suggest to install sources of support files in the binary distrib (dfd621297592320510afd553361fcc32116842dc). Do you agree?

dra27 commented 6 years ago

I hadn't properly registered that, sorry - actually, with this flag, I'm kind of wondering if there needs to be object files in the binary distribution at all? FlexDLL obviously makes no sense as a package without a compiler, so why not just package up flexlink.exe and always require flexlink -install?

That's related to my suggestion of shifting towards always installing the objects with the application (i.e. OCaml - or in an arch-specific folder for the Cygwin/MSYS packages). Not keeping them with flexlink.exe also neatly solves the problem of wanting to have msvc objects compiled for pre- and post-VS2015.

alainfrisch commented 6 years ago

I'm kind of wondering if there needs to be object files in the binary distribution at all

Of course we could drop them altogether, but keeping them allows for a smoother transition. One can tell people to upgrade to, say, flexdll 0.38, and it will work even if they have e.g. older versions of OCaml still around.

The official instructions will likely be to use flexlink -install, but breaking compatibility does not seem necessary.