Simple Interop?? C# - F# question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Pabcdef
    New Member
    • Feb 2008
    • 1

    #1

    Simple Interop?? C# - F# question

    I'd like to do the following:

    Program.cs:
    Code:
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                System.Console.WriteLine("cs main");
                ConsoleApplication1.Code.brain();
            }
    
            static void Pain()
            {
                System.Console.WriteLine("cs pain");
            }
        }
    }
    Code.fs:
    Code:
    module ConsoleApplication1.Code
    
    let brain () = printf "fs brain\n"; ConsoleApplication1.Program.Pain ()
    Clearly, simply by adding these two files into a VS 2008 (.NET 3.5, F# add-on installed) console application project, it doesn't work, but I haven't got much of a clue about how to solve it myself. I've checked out manuals and howtos which talk about assembly-referencing, but besides I don't really know what an assembly is, I guess what I want to do is to put both, the c# class and the f# module into the same assembly. C# classes can mutually recursively reference each other, so I guess it should be possible using several languages, too.
    But how to get my Visual Studio doing this?
    Any hint about how to compile it (or anything similar !) without VS would be greatly appreciated, too.
    Thanks a lot.
    Paolo
Working...