what is the difference between .so and .a files?

南笙酒味 提交于 2019-12-03 04:47:57

But it appears that even .a is shared library

Nope, it's a static library.

and can be used just like a .so lib

If you mean linking to it, then yes. But you can't dlopen() an .a file which you could do with an .so file.

You can always ask our old friend Uncle G to answer your questions.

gks

A .a file is a static library, while a .so file is a shared object dynamic library similar to a DLL on Windows.

A .a can included as part of a program during the compilation & .so can imported, while a program loads.

When you link against the *.a, the code from the library is included in the executable itself and the executable can be run without requiring the *.a file to be present. When you link against the *.so, that is not the case and the *.so file must be present at runtime.

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