Let's say I have the following function.
let rec fib n =
match n with
| 1 | 2 -> 1
| n -> fib(n-1) + fib(n-2)
How can I compile this code into dll so that it's used from C#?
I use both mono (in Mac OS X) and Visual Studio 2010.
ADDED
I added the following to make namespace.
namespace MyMath.Core module public Process=
And fsc --target:library facto.fs gives me facto.dll.
The C# code to use this code as follows.
using System;
using MyMath.Core;
class TestFSharp {
public static void Main() {
int val = MyMath.Core.Process.fib(10);
Console.WriteLine(val);
}
}
dmcs /r:facto.dll testf.cs gives me tesetf.exe.