It’s weird title framing and I apologise, let me express with more words:
The context here is I want to make sure I’m implementing the same interface as a dependency and would love to depend (or copy/sync/whatever method) on the mli file either given by the library or the cmi itself. This way I will be sure that my implementation type-checks to it.
The only “rule” is that I don’t want to change the library core for this particular case.
I tried copying the cmi file over, but with no much success. Do you have any other idea or solid methodology here?
Can you use module type of? E.g. if the dependency has a file foo.mli, you could use module type of Foo to get its module type. Suppose your implementation is in impl.ml, then your impl.mli would be include module type of Foo.
There’s no possibility to mix mode melange and native modules, unless I have more than one mode on each library which is not possible due to platform specific stuff.
and, If there’s a way of doing so, there’s no way I can use 2 modules with the same name (to type of eachother)
You have foo/a.ml, and bar/a.ml, bar/a.mli, and you want to compile foo/a.ml using bar/a.mli?
Starting with v5 you can pass --cmi-file in case it is in some other directory that the .ml file. Otherwise, the compiler will look for the mli file, not the cmi file, when deciding if it needs to generate a cmi file.