MigMit | 22 Mar 23:04 2013
Picon

Compiled code

Suppose I compiled some module and kept it's .hi and .o files. Is it possible to use this module in my program
if the source code was deleted for some reason?

Seems like the answer is "yes" — by creating a fake .hs file (with no real content) and touch-in .hi and .o
files I tricked ghc so that it didn't attempt to recompile the module, so the information in .hi and .o files
is sufficient. But ghc insists on having the .hs file around, and I didn't find a way to turn it off. Is there
any? Or there is a specific reason not to allow this?
MigMit | 22 Mar 23:28 2013
Picon

Re: Compiled code

Sorry, I think that's not the right list for this question.

Отправлено с iPhone

23.03.2013, в 2:04, MigMit <miguelimo38 <at> yandex.ru> написал(а):

> Suppose I compiled some module and kept it's .hi and .o files. Is it possible to use this module in my program
if the source code was deleted for some reason?
> 
> Seems like the answer is "yes" — by creating a fake .hs file (with no real content) and touch-in .hi and .o
files I tricked ghc so that it didn't attempt to recompile the module, so the information in .hi and .o files
is sufficient. But ghc insists on having the .hs file around, and I didn't find a way to turn it off. Is there
any? Or there is a specific reason not to allow this?
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe <at> haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Erik de Castro Lopo | 23 Mar 02:46 2013

Re: Compiled code

MigMit wrote:

> Suppose I compiled some module and kept it's .hi and .o files. Is it
> possible to use this module in my program if the source code was deleted for some reason?
> 
> Seems like the answer is "yes"

The answer is yes as long as the compiler version and the versions of
all libraries your orignal .hs file used remain the same. As soon as
any of these versions change, you need the full original .hs file.

Erik
--

-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/
Erik de Castro Lopo | 23 Mar 03:00 2013

Re: Compiled code

Erik de Castro Lopo wrote:

> MigMit wrote:
> 
> > Suppose I compiled some module and kept it's .hi and .o files. Is it
> > possible to use this module in my program if the source code was deleted for some reason?
> > 
> > Seems like the answer is "yes"
> 
> The answer is yes as long as the compiler version and the versions of
> all libraries your orignal .hs file used remain the same. As soon as
> any of these versions change, you need the full original .hs file.

If you change the compiler flags (eg optimisation levels) you will also
need the full original .hs file.

Erik
--

-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/
Krzysztof Skrzętnicki | 23 Mar 08:22 2013
Picon

Re: Compiled code

They are used: any library installed with e.g. cabal-install is kept around not in source form but with .hi and .o files (and perhaps some metadata as well.)

Best regards,
Krzysztof Skrzętnicki


On Fri, Mar 22, 2013 at 11:04 PM, MigMit <miguelimo38 <at> yandex.ru> wrote:
Suppose I compiled some module and kept it's .hi and .o files. Is it possible to use this module in my program if the source code was deleted for some reason?

Seems like the answer is "yes" — by creating a fake .hs file (with no real content) and touch-in .hi and .o files I tricked ghc so that it didn't attempt to recompile the module, so the information in .hi and .o files is sufficient. But ghc insists on having the .hs file around, and I didn't find a way to turn it off. Is there any? Or there is a specific reason not to allow this?
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Gmane