How to make a callback to GO method from C++ DLL

huangapple go评论85阅读模式
英文:

How to make a callback to GO method from C++ DLL

问题

我有一个GO程序,其中有一个函数调用了一个在dll中定义的C方法的CGO调用。这部分工作得很好。
现在我需要从我的dll回调到GO。这可能吗?有什么帮助的指针吗?

请注意,我的DLL代码是一个独立的代码库,通过使用Visual Studio单独编译和链接来生成dll。我使用的是64位的Windows 10机器。

英文:

I have a GO program with a function that make a CGO call to c method defined in a dll. That part works great..
Now i need to make a callback from my dll to GO. Is that possible, any helping pointers ?

Note that my DLL code is separate codebase which gets compiled and linked separately to generate dll using visual studio. I'm on windows 10 64 bit machine.

答案1

得分: 3

我找到了我要找的东西。在这里发布,以便帮助其他人解决这个问题。

https://github.com/golang/go/wiki/cgo#function-pointer-callbacks

英文:

I found exactly what i was looking for. Posting here so that it may help other with this problem.

https://github.com/golang/go/wiki/cgo#function-pointer-callbacks

huangapple
  • 本文由 发表于 2017年1月16日 18:47:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/41674590.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定