Linux, Mono, shared libs and unresolved symbols

只愿长相守 提交于 2019-12-06 14:25:55

You should specify the dependency when you link the wrapper library like

g++ -shared -Wl,-soname,libexif-wrapper.so.1 -o libexif-wrapper.so.1.0.1 libexif-wrapper.o -lc -lexif

When you do that the dynamic linker knows that libexif-wrapper depends on libexif and it can resolve the symbols on load.

I'm confused about why you need -lc, but maybe that's a Mono oddity...

Does it work if you add -lexif to the link command? It seems that you're creating a shared library with undefined symbols, but not saying where those symbols should come from. This actually is useful sometimes -- say, creating a plugin that uses a symbol that's expected to be already provided by the application loading it -- but not what you want here; I don't see how libdl (or however Mono loads libraries, maybe it has its own implementation) would know that it needs to load libexif.so for use in your library.

Hopefully you don't have to do something horrible like add libexif.so to the archive...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!