F# fails to load customized factor made in C# RRS feed

  • Question

  • I built a factor in a C# project, it works well in c#

    However, when I try to load it in F#,

       // MyFactor is my C# Factor Class

        let myFactor = Factors.createDelegate <@ MyFactor.Do(0.0) @> :?> FactorMethod<double, double>

        let a = Variable<double>.Factor(myFactor, 1.1)

    When I run, it gives me infer.CompilationFailedException, saying something that MyFactor.Do(double x) has no registered operators.

    It seems that it cannot find the implementation of my factor.

    I have already put  [assembly: MicrosoftResearch.Infer.Factors.HasMessageFunctions] into C# project.

    Is there any other stuff I need to do to make a factor available in F#

    • Edited by colinfang Thursday, October 16, 2014 5:54 PM
    Thursday, October 16, 2014 5:48 PM

All replies

  • Hello,

    It's possible that F# has merely referenced, but not loaded, the C# dll, because you only reference the dll from a quotation.

    Can you try adding a (non-quoted) call  into the dll


      let _ = MyFactor.init(); // for a dummy initialization method...




    Friday, October 24, 2014 2:41 PM