dourang20110122 2015-01-22 13:14
浏览 38
已采纳

有没有办法在.Net中包装Go库

I have seen here and there that Go is like a modern-time C/C++ (meaning: with modern syntax and memory management, but about as fast).
I'm interested in leveraging the power of such a language, to include an image processing library in our .Net application.

But that raises the problem of wrapping the Go library in a .Net shell. I have successfully wrapped a C library using C++/CLI ; is there a way to do a similar thing with Go ?

I would like to NOT use Swig, which I tried before, and is absolutely awful and doesn't work most of the time.

  • 写回答

1条回答 默认 最新

  • duanaozhong0696 2015-01-22 14:18
    关注

    It is currently not possible to embed Go code into a program whose main language isn't Go because Go needs a non-trivial runtime that hooks into many things. The only possible thing is to call C functions from a Go program; these functions may then in turn call Go functions. You might want to design a solution that uses some sort of inter-process communication instead where the part you want to write in Go runs in a different process.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据