[Mono-dev] Multiply-defined symbols with F#
Jonathan Pryor
jonpryor at vt.edu
Wed Feb 6 18:35:48 EST 2008
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.
- Jon
More information about the Mono-devel-list
mailing list