English 中文(简体)
共享图书馆的全球法定领域—— 他们到哪里去?
原标题:Static Global Fields in a Shared Library - Where do they go?
  • 时间:2009-10-16 17:36:15
  •  标签:

我有一份剪辑,我正在制作一个共享的图书馆(使用汽车等)。 在申请档案中,我宣布了我在整个图书馆工作中使用的两块固定领域。

我的问题是两部分:

(1) 这些油田储存在什么地方? 这并不像该系统对整个图书馆进行即时,并保存在记忆中......图书馆毕竟确实只是一只hoo。

(2) 是否有更好的办法这样做? 我之所以开始,是因为我想避免要求用户将田地变成每个图书馆功能的参数。

感谢!

最佳回答

The code used to load shared libraries:
Generally (each has minor technical differences):

  • Loads the shared lib into memory
  • Walks the symbol table and updates the address of function in the DLL
  • Initializes any global static members using their constructor.

Note: The shared lib loader need not do all this at the load point.
It may do some of these jobs lazily (implementation detail). But they will be done before use.

任何全球硬性分配变量(无构件)。 将根据天气情况,储存在特殊记忆部分(具体执行细节)。 如果它们初步化,它们将装上已经界定的磁盘(或共享的平衡来源)。

因此,回答你的问题:

  • undefined.
    • The library is code segments
    • Initialized data segments
    • Uninitialized data segments
    • Some utility code that knows how to link it into a running application.
  • Better than what exactly
    • Good practice would suggest passing values to a function rather than relying on global state. But to be honest that is an over generalization and really down to the problem.
问题回答

从逻辑上讲,它is,好像该系统能对整个图书馆进行现场直播。 在实践中,只有该守则在共享图书馆中真正“共享”,任何与其联系的人都将获得数据副本。 (Well可能并非仅读数据)。 迄今为止,你的问题如下:

(1) 您的工作将获得一份变数的复印件(取决于贵处共享图书馆系统如何运作)。

(2) 我看不出这种做法存在问题。





相关问题
热门标签