dongzhong5833 2017-09-29 05:54 采纳率: 0%
浏览 145

如何将golang目标文件链接到动态库?

I used swig to wrap c++ in my golang project, I find that golang build can do separately:

  1. generate object file
  2. link the object file to binary file

like this(I get these from makefile):

go tool compile -pack -o runme.o runme.go
go tool link -linkmode external -extld "g++" -extldflags "-I/include/boost-0" -o runme runme.o

Anyway this works fine, but now I am facing a situation, I have to generate c-share library. I know that go build support -buildmode=c-shared.

So can I link the object runme.o file to librunme.so?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Vue3 大型图片数据拖动排序
    • ¥15 划分vlan后不通了
    • ¥15 GDI处理通道视频时总是带有白色锯齿
    • ¥20 用雷电模拟器安装百达屋apk一直闪退
    • ¥15 算能科技20240506咨询(拒绝大模型回答)
    • ¥15 自适应 AR 模型 参数估计Matlab程序
    • ¥100 角动量包络面如何用MATLAB绘制
    • ¥15 merge函数占用内存过大
    • ¥15 使用EMD去噪处理RML2016数据集时候的原理
    • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大