[Mono-dev] Multiply-defined symbols with F#

Casey Marshall cmarshall at pacificbiosciences.com
Thu Feb 7 17:51:04 EST 2008


On Wed, 2008-02-06 at 18:35 -0500, Jonathan Pryor wrote:
> On Wed, 2008-02-06 at 15:02 -0800, Casey Marshall wrote:
> > I'm trying to use F# with mono, and most everything works fine, except
> > when I try to reference FSharp.Core.dll from a C# assembly. I get this
> > error:
> > 
> > > error CS0433: The imported type `System.Action`2' is defined multiple
> > > times
> > > /opt/mono/lib/mono/gac/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll (Location of the symbol related to previous error)
> > > .../FSharp.Core.dll (Location of the symbol related to previous error)
> > > error CS0433: The imported type `System.Action`3' is defined multiple
> > > times
> 
> > Now, this makes sense: both System.Core.dll and FSharp.Core.dll define
> > 'System.Action' types. But, is there any way to work around this?
> 
> Yes.  Either don't use System.Core.dll (which really isn't any fun), or
> use extern aliases:
> 
>         extern alias A;
>         using System;
>         using MyAction = ND::System.Action<int, int>;
>         
>         class Test {
>             public static void Main ()
>             {
>                 A::System.Action<int, int> a = null;
>                 MyAction b = null;
>             }
>         }
> 
> Then you'd compile with:
> 
>         gmcs -r:A=FSharp.Core.dll -r:System.Core.dll YourFile.cs
> 
> and the System.Action defined in FSharp.Core.dll would be used.
> 

Worked like a charm, thanks.

I had tried -langversion:ISO-2, but that didn't seem to work for me.



More information about the Mono-devel-list mailing list