#1533: FFI: exporting the same thing multiple times fails: error: redefinition 
of
‘stginit_export_ShouldCompile_zdfdiv’
-----------------------------+----------------------------------------------
  Reporter:  igloo           |          Owner:         
      Type:  bug             |         Status:  new    
  Priority:  high            |      Milestone:  6.8    
 Component:  Compiler (FFI)  |        Version:  6.6.1  
  Severity:  normal          |       Keywords:         
Difficulty:  Unknown         |             Os:  Unknown
  Testcase:  cc013           |   Architecture:  Unknown
-----------------------------+----------------------------------------------
If we foreign export the same thing multiple times, e.g.:
 {{{
 foreign export ccall "addByte" (+) :: Int8  -> Int8  -> Int8
 foreign export ccall "addInt"  (+) :: Int16 -> Int16 -> Int16
 foreign export ccall "addLong" (+) :: Int32 -> Int32 -> Int32
 }}}
 then compilation fails due to redefinition of
 stginit_export_ShouldCompile_zdfzp.
 In the _stub.c we generate
 {{{
 static void stginit_export_ShouldCompile_zdfzp()
 __attribute__((constructor));
 static void stginit_export_ShouldCompile_zdfzp()
 {getStablePtr((StgPtr) &ShouldCompile_zdfzp_closure);}
 }}}
 n times.

 It looks like the fix is simply to only generate it once; we just need to
 rejig the code so that that happens.

 Test is cc013.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1533>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to