Compile with standalone flag gives compilation errors in client code

前端 未结 1 1426
再見小時候
再見小時候 2021-02-19 11:22

I\'m attempting to compile Zero29 with the --standalone compiler flag. The project itself compiles fine, but I have a unit test project that exercises some code in

相关标签:
1条回答
  • 2021-02-19 11:31

    Libraries compiled with the --standalone switch cannot expose any F# datatypes. This is, for one, expressly stated in Pickering (2007), p. 210. In your case, a discriminated union is one of these prohibited types. The fact that the file is an executable changes nothing here: it becomes a library the moment you attempt to use it as one.

    There have been also multiple reports (for example, here and here) that even libraries compiled with --standalone behave, quoting one of these sources, “funky.” It would be safe to say that the use of this switch should perhaps be limited to stand-alone executables only (and they cannot pretend to be a library even when under unit tests).


    Pickering R. (2007). Foundations of F#. Apress.

    0 讨论(0)
提交回复
热议问题