<pre><code>.
├── __pycache__
│ └── runner.cpython-36.pyc
├── cpuprofile
├── csvTools
│ ├── constantsDev.go
│ ├── csvSources.go
│ └── csvTools.go
├── main.go
├── runner.py
</code></pre>
<p>Lets say I have the above directory structure. Currently I only know how to export functions via <code>main.go</code>. However id like to pull functions outside of my <code>csvSources.go</code> file without having to literally copy and paste functions into main just for the sake of exporting. Is there any way to do this? </p>
<p>Here is my build command <code>go build -buildmode=c-shared -o csvTools.so main.go</code></p>
<p><strong>Edit:</strong> I am not talking about capitalizing something. I am talking about the <code>//export</code> comment for FFI -> c shared libraries. </p>
<hr/>**评论:**<br/><br/>0xjnml: <pre><p>A thing is exported from a package, which is a directory, not a file, if it's a top-level declaration, name of which starts with a capital letter (Uncode category Lu, IIRC). Where the package is located in the filesystem tree does not matter as long as its located anywhere under $PATH/src. The location however defines the import path that one must use to import the exported things. The import path is the absolute directory path with the $PATH/src prefix removed.</p>
<p>edit: s/filem/file,/, s/i'ts/it's/</p></pre>maximus12793: <pre><p>I am talking about exporting to a c library which is why I put FFI in the title. Please see my edit</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
0 回复
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传