linkning linux static libraries in windows with cygwin

只谈情不闲聊 提交于 2019-12-11 09:59:27

问题


I'm having a binary static library libfoo.a compiled for 32 bit linux machine. I wish to compile it against my win32 project compiled with cygwin.

Is that possible? It seems to be possible, as all the object files in the archive should be in the standard ELF format.

However I keep recieving linking errors about functions that nm finds in the libfoo.a. When I created a stub libfoo.a with some empty functions with the same names of those in libfoo.a, I didn't recieve linking errors about those functions any longer.

Is that even possible or am I missing something? At any rate, how can I troubleshoot this problem?


回答1:


Even if you succeed in linking you won't avoid incompatibility of code built on different platforms. For example headers (glibc and others) are different there. To ensure compatibility additional mechanisms similar to mangling seem to be used on symbols exported by object files.

I've met a problem similar to yours when tried to link together object files compiled for different processor architecture - nm showed all needed functions are present, but linker didn't believe that.



来源:https://stackoverflow.com/questions/2636284/linkning-linux-static-libraries-in-windows-with-cygwin

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