.o对象文件和.so库文件有什么区别?

时间:2021-11-22 03:27:54

Like the title says, what is the difference between a "program object file" (.o extension) and a "library file" (.so extension)

就像标题所说,“程序对象文件”(.o扩展名)和“库文件”(.so扩展名)之间有什么区别

1 个解决方案

#1


Well, its been a while so forgive me if I am totally wrong but it would essentially mean that the code inside the .so can be relocatable.

好吧,它已经有一段时间了,如果我完全错了,请原谅我,但这实际上意味着.so中的代码可以重定位。

The .so is essentially a DLL that can be used by many applications but only loaded once into memory. The .o has to be linked into an application to have the code functionality made available.

.so本质上是一个DLL,可以被许多应用程序使用,但只加载一次到内存中。必须将.o链接到应用程序以使代码功能可用。

This is called static linking (.o) vs dynamic linking (.so)

这称为静态链接(.o)与动态链接(.so)

See: IBM Developer Works or Uni of Calgary or IECC for further information

有关详细信息,请参阅:IBM Developer Works或Uni of Calgary或IECC

Hope this answers your questions (and I hope my explaination is correct!)

希望这能回答你的问题(我希望我的解释是正确的!)

#1


Well, its been a while so forgive me if I am totally wrong but it would essentially mean that the code inside the .so can be relocatable.

好吧,它已经有一段时间了,如果我完全错了,请原谅我,但这实际上意味着.so中的代码可以重定位。

The .so is essentially a DLL that can be used by many applications but only loaded once into memory. The .o has to be linked into an application to have the code functionality made available.

.so本质上是一个DLL,可以被许多应用程序使用,但只加载一次到内存中。必须将.o链接到应用程序以使代码功能可用。

This is called static linking (.o) vs dynamic linking (.so)

这称为静态链接(.o)与动态链接(.so)

See: IBM Developer Works or Uni of Calgary or IECC for further information

有关详细信息,请参阅:IBM Developer Works或Uni of Calgary或IECC

Hope this answers your questions (and I hope my explaination is correct!)

希望这能回答你的问题(我希望我的解释是正确的!)