相关疑难解决方法(0)

静态链接与动态链接

在某些情况下,是否有任何令人信服的性能原因选择静态链接而不是动态链接?我已经听过或读过以下内容,但我对这个问题的了解不足以保证它的真实性.

1)静态链接和动态链接之间的运行时性能差异通常可以忽略不计.

2)(1)如果使用使用配置文件数据优化程序热路径的配置文件编译器,则不成立,因为使用静态链接,编译器可以优化代码和库代码.通过动态链接,您的代码可以进行优化.如果大部分时间都花在运行库代码上,那么这可能会产生很大的不同.否则,(1)仍然适用.

c c++ performance dynamic-linking static-linking

382
推荐指数
14
解决办法
22万
查看次数

静态Vs动态库

我读过有关静态和动态库的内容.我的问题很少

dlopen dlclose:

Benifit of dlopen is  we can start the EXE with out
loading the necessary libraries at the begining. Only when we
need we will load the libratries and unload it from the memory.
Run Code Online (Sandbox Code Playgroud)

这是动态链接库的行为.

我的问题是,如果我链接库libUtlities

ld -o EXE main.o -lUtilities 
Run Code Online (Sandbox Code Playgroud)

当我运行EXE时,在我第一次使用这些功能之前,libUtlities将被加载到内存中

which i observed in dbx (Solaris debugger)
But will not contribute to the size of the EXE.
Run Code Online (Sandbox Code Playgroud)

1.它是静态链接还是动态链接.?

c c++ dynamic static-libraries dlopen

2
推荐指数
1
解决办法
1312
查看次数