2016-06-10 19:02
浏览 244


Is there any way to execute a Go function from C#? For Python I would use Ironpython for example.

I know that I could spawn a process to execute a Go script, but I don't really want to fallback to such a solution, if possible.

A Google search didn't reveal anything, so is there any way to do that using an API? Or do I have to fallback on processes?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • dongping4901
    dongping4901 2016-06-10 19:31

    I don't think you're going to have much luck finding what you're looking for. Go is statically linked and C# doesn't support that.

    From C#, calling a pre-compiled executable and reading the output is the easiest thing I can think of.

    点赞 评论
  • duanqiao8925
    duanqiao8925 2018-05-08 03:39

    I think Frank's answer is not right! Golang supports many build mode, and one is c-shared mode, it means you can use it like a c module. e.g:

    点赞 评论
  • dptx8888
    dptx8888 2018-05-09 02:25

    you can use grpc implement calls
    grpc works across languages and platforms

    点赞 评论