[Haskell-cafe] Annoyed at System.Random

Vincent Hanquez tab at snarc.org
Fri May 4 16:33:29 CEST 2012


On 05/04/2012 03:18 PM, Brandon Allbery wrote:
> On Fri, May 4, 2012 at 10:11 AM, Vincent Hanquez <tab at snarc.org 
> <mailto:tab at snarc.org>> wrote:
>
>     For the language, i think assembly is a no-no with cabal, as such it need
>     to be embedded in gcc inline assembly if you want to have something that
>     works (unless there's a secret way to run assembler in a portable fashion
>     in cabal).
>
>
> I don't know if cabal knows this, but assembler files with .s (and maybe .asm 
> on Windows?) extension are recognized by most C compilers and handed off to 
> the assembler; as such, simply augmenting cabal's C rules with those 
> extensions should be sufficient.

That might works, although you might end up with some corner case portability 
issues.
Wrapping them in C should be more practical and you could write something like 
this for maximum portability (compiler,systems,..):

#if system_that_works_with_inline_asm
asm inline("instr1; instr2;", ....);
#else
  /* fallback to C */
#endif

-- 
Vincent



More information about the Haskell-Cafe mailing list