Gecko NSModule: ContractIDEntry “nsID const *”?

穿精又带淫゛_ 提交于 2019-12-11 14:54:00

问题


I created a FireFox addon a while a go, and noticed it stopped working on FireFox 3.6 Apparently, NSGetModule is being replaced with an NSModule structure, so I have to adapt. I'm coding my product with Delphi, so I have to port the new code to Object Pascal.

If I look over this code: http://mxr.mozilla.org/mozilla-central/source/xpcom/components/Module.h

I notice that the "cid" property of the ContractIDEntry struct, is defined as nsID const *

Does this mean that there's a pointer to a nsID variable in the struct, or that the nsID value is itself part of the struct?


回答1:


The full declaration is this:

struct ContractIDEntry
{
  const char* contractid;
  nsID const * cid;
};

Just as the declaration of contractid means that the struct contains a pointer to a char and not that the char is part of the struct, the declaration of cid means the struct contains a pointer to an nsID. The struct does not contain an nsID, merely a pointer to one.

Technically, it's a pointer that is not allowed to be used to modify the pointed-to value, but Delphi doesn't have that concept, so declare it as just an ordinary pointer.



来源:https://stackoverflow.com/questions/4065202/gecko-nsmodule-contractidentry-nsid-const

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