[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MirageOS-devel] linking hack considered harmful



Incidentally, I just noticed one good side-effect to the renaming of the global 
Console module to Console_unix and Console_xen.

Previously this code would compile:

module Client (C:CONSOLE) (S:STACKV4) = struct

  let start c s =
    Console.log_s c "Starting to resolve in 3s..." >>= fun () -> 
    OS.Time.sleep 3.0 >>= fun () ->
    <etc>

end

See the problem?  It'll now fail to link with a 'module Console not found', and 
should be

module Client (C:CONSOLE) (S:STACKV4) = struct

  let start c s =
    C.log_s c "Starting to resolve in 3s..." >>= fun () -> 
    OS.Time.sleep 3.0 >>= fun () ->
    <etc>

end

So it is parameterised across the Console functor now, and not a global module.

-anil

> On 20 Oct 2014, at 13:27, Anil Madhavapeddy <anil@xxxxxxxxxx> wrote:
> 
> Clock and Io_page, at least.
> 
> Anil
> 
> 
> 
>> On 20 Oct 2014, at 12:46, Richard Mortier <Richard.Mortier@xxxxxxxxxxxxxxxx> 
>> wrote:
>> 
>> cool! 
>> 
>> are there any other (core) modules where this linking hack was also being 
>> applied that will also need untangling like this?
>> 
>>> On 18 Oct 2014, at 14:43, Anil Madhavapeddy <anil@xxxxxxxxxx> wrote:
>>> 
>>> Dave and I have just untangled several build issues with mirage-console.  
>>> What was happening previously is that we had two packages: 
>>> mirage-console-unix and mirage-console-xen, which both provided a Console 
>>> module.  Since we never need to have both a Xen and a Unix console, we just 
>>> selected the right ocamlfind package at link time to supply the correct one 
>>> (aka the "linking hack").
>>> 
>>> When the console support became more sophisticated (support for multiple 
>>> consoles), Dave factored out some functionality into a common package.  At 
>>> this point, the linking hack became unworkable due to dependency issues.
>>> 
>>> What we've done in mirage-dev is to go back to a unified mirage-console 
>>> package that provides these ocamlfind packages:
>>> - mirage-console       (module types)
>>> - mirage-console.proto (xen protocol)
>>> - mirage-console.unix  (Console_unix console with lwt.unix)
>>> - mirage-console.xen   (Console_xen console with xenstore/etc)
>>> 
>>> The mirage.2.0.0 frontend now aliases Console to Console_unix or 
>>> Console_xen when generating main.ml, which seems a lot simpler than 
>>> depending on which link-time module to use.
>>> 
>>> Any more build problems, let me or Dave know!
>>> 
>>> -anil
>>> _______________________________________________
>>> MirageOS-devel mailing list
>>> MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
>>> http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel
>> 
>> 
>> -- 
>> Cheers,
>> 
>> R.
>> 
>> 
>> 
>> 
> 
> _______________________________________________
> MirageOS-devel mailing list
> MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
> http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel
> 


_______________________________________________
MirageOS-devel mailing list
MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.