开发者

XPCOM component DLL loads into Firefox, but then fails to register its class

I have an XPCOM component whose source when compiled, works fine on Linux, but does not work on Windows. The DLL is clearly being loaded as expected by Firefox as revealed by the dependency walker program, but it appears never to be executed by it.

This is the command line I am using to compile it all:

[4/5] cxx: components\nsSoundSubsystem.cpp -> build\components\nsSoundSubsystem.cpp.2.o
15:44:31 runner ['C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\BIN\\CL.exe', '/nologo', '/MT', '/IE:\\src\\chunder\\clients\\xpcomextension\\build', '/IE:\\src\\chunder\\clients\\xpcomextension', '/IE:\\src\\chunder\\clients\\xpcomextension\\build\\components', '/IE:\\src\\chunder\\clients\\xpcomextension\\components', '/IC:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\INCLUDE', '/IC:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A\\include', '/Ic:\\xulrunner-sdk\\include', '/DHAVE_XPCOM_CONFIG_H=1', '/DMOZ_NO_MOZALLOC', '/DWIN32', '/D_WINDOWS', '/D_USRDLL', '/DXP_WIN', '/DXP_WIN32', '/DXPCOM_GLUE_USE_NSPR', '..\\components\\nsSoundSubsystemModule.cpp', '/FC', '/c', '/Focomponents\\nsSoundSubsystemModule.cpp.2.o']
15:44:31 runner ['C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\BIN\\CL.exe', '/nologo', '/MT', '/IE:\\src\\chunder\\clients\\xpcomextension\\build', '/IE:\\src\\chunder\\clients\\xpcomextension', '/IE:\\src\\chunder\\clients\\xpcomextension\\build\\components', '/IE:\\src\\chunder\\clients\\xpcomextension\\components', '/IC:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\INCLUDE', '/IC:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A\\include', '/Ic:\\xulrunner-sdk\\include', '/DHAVE_XPCOM_CONFIG_H=1', '/DMOZ_NO_MOZALLOC', '/DWIN32', '/D_WINDOWS', '/D_USRDLL', '/DXP_WIN', '/DXP_WIN32', '/DXPCOM_GLUE_USE_NSPR', '..\\components\\nsSoundSubsystem.cpp', '/FC', '/c', '/Focomponents\\nsSoundSubsystem.cpp.2.o']
nsSoundSubsystem.cpp
nsSoundSubsystemModule.cpp
[5/5] cxxshlib: build\components\nsSoundSubsystemModule.cpp.2.o build\components\nsSoundSubsystem.cpp.2.o -> build\components\chunder_x86.dll build\components\chunder_x86.dll.manifest build\components\chunder_x86.lib
15:44:32 runner ['C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\BIN\\LINK.exe', 'components\\nsSoundSubsystemModule.cpp.2.o', 'components\\nsSoundSubsystem.cpp.2.o', '/OUT:E:\\src\\chunder\\clients\\xpcomextension\\build\\components\\chunder_x86.dll', '/LIBPATH:C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\LIB', '/LIBPATH:C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A\\lib', '/LIBPATH:c:\\xulrunner-sdk\\lib', 'xpcom.lib', 'xpcomglue_s_nomozalloc.lib', 'nspr4.lib', '/NOLOGO', '/MANIFEST', '/DLL', '/machine:I386', '/IMPLIB:components\\chunder_x86.lib']
  开发者_JAVA技巧 Creating library components\chunder_x86.lib and object components\chunder_x86.exp
15:44:33 runner ['C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A\\bin\\MT.exe', '/NOLOGO', '-manifest', 'E:\\src\\chunder\\clients\\xpcomextension\\build\\components\\chunder_x86.dll.manifest', '-outputresource:E:\\src\\chunder\\clients\\xpcomextension\\build\\components\\chunder_x86.dll;2']

I am at my wits' end, three days in this chase.

What am I doing wrong? Alternatively, what can I do to help me debug the issue?

Additional info: I am using Firefox 4 to run the module, and the XULrunner 2.0 SDK to compile the module. The interface from the XPT file registers itself just fine.


Looking at nsNativeModuleLoader::LoadModule, dependencies are not the problem here - failing dependencies would result in the library not loading in the first place, there wouldn't be anything to unload. There are two conditions under which the library will be unloaded: symbol NSModule is not defined or module version doesn't match. From your description, the former is the problem, it should really be NSModule and not _NSModule. So I guess that you are using something other than NSMODULE_DEFN() macro. See http://mxr.mozilla.org/mozilla-central/source/xpcom/sample/nsSampleModule.cpp for an example of a correct module definition. Should my guess be incorrect please show us your module definition code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜