英文:
One way to do in-process dynamic plugin in golang
问题
最近我正在尝试在Go语言中构建一个动态插件框架,我知道plugin
构建模式尚未实现。
所以我考虑将Go插件构建为C风格的共享对象,然后主程序使用C.dlopen
加载插件。
复杂的数据结构可以通过JSON编码的字符串传递。
这种方法可行吗?或者会有什么可预见的缺点?
提前感谢。
英文:
recently I'm trying to build a dynamic plugin framework in golang, I know the plugin
buildmode hasn't been implemented yet.
So I'm thinking about building go plugin into c-style shared objects and the main program loading plugins using C.dlopen
.
Complex data struct can be passed by json-encoded string.
Is this means doable? Or is there any foreseeable disadvantage could be caused?
Thanks in advance.
答案1
得分: 0
这种方法不是进行动态插件加载/重新加载的可行方式。
详细信息请参考这里:https://github.com/golang/go/issues/11100
即使在golang 1.8中的插件功能也不支持重新加载。
英文:
This method is not a possible way to do the dynamic plugin loading/reloading.
The detail lies here: https://github.com/golang/go/issues/11100
Even the plugin feature in golang 1.8 doesn't support reloading.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论