export symbol from a package in a plugin

blov · · 481 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Hi all! Currently i&#39;m trying to use 3rd part lib as a plugin in my project and faced difficulties with exporting symbols. It seems that go exports symbols only from the main package, but not from others. </p> <pre><code>src/ package/ package.go &lt;- has sybol func Foo() main.go &lt;- has import _ &#34;./package&#34; </code></pre> <p>Is there a way around of this? </p> <hr/>**评论:**<br/><br/>Femaref: <pre><p>that is by design. Imports are only for the current file. If you want to use <code>Foo</code> elsewhere, you need to import the package it is defined in.</p></pre>x_Fresh_x: <pre><p>After some research, i decided to wrap dlopen and use that to export fields/funcs i need. The topic may be considered as closed. </p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

481 次点击  
加入收藏 微博
0 回复
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传