开发者

Static/dynamic libraries vs .so libaries?

I come from a windows w/ visual-studio background for native development and I am now going to compile native code for use on android.

I am not sure how the unix-like libraries (.so?) work. Are they static (like a .lib on windows) or dynamically loaded like a DLL? For example, in visual studio, I add the .lib file to my project for compiling, and then load the .dll during runtime. What is the eq开发者_StackOverflow社区uivalent in unix-stuff, say by using GCC?

Thanks!


On Linux, the .so files are the equivalent(*) of the .dll files on Windows, in the sense that they are loaded dynamically to the executable when it is executed. Note however that you don't need a .lib file when linking your application. The linker will find the information directly in the .so file.

*: There are differences.


First, you should read a page on Static, Shared Dynamic and Loadable Linux Libraries.

That should clarify several of your questions. That page has source code examples which are nice for beginners.

Another interesting reference is Writing DLLs for Linux apps.


.so files on Linux act the same way as .dll on Windows and .dylib on Mac OSX.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜