id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
1533,FFI: exporting the same thing multiple times fails: error: redefinition of ‘stginit_export_ShouldCompile_zdfdiv’,igloo,simonmar,"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.",bug,closed,high,6.8.1,Compiler (FFI),6.6.1,fixed,,,Unknown/Multiple,Unknown/Multiple,,Unknown,cc013,,,
