I was hoping someone would provide a complete list of what needs to be changed in order to make him work on a later gecko, but since no one did, I will try to do it myself using this sample I just found.
xpidl.exe
I do not know if this has changed or not, so it may not be necessary. There is no xpidl.exe in Gecko 11. The solution for this is from Philip Chee
It has been replaced with a Python script. You can continue to use the XPIDL from the Gecko 7.0 SDK or compile it from the source or use the Python script.
Gecko 7.0 can be downloaded from ftp HERE . It really has xpidl.exe. Usage is the same as in the example.
Component module implementation
This seems to have changed a lot. The link in MDN is another link (which goes back to the sample shown above, but explains the material).
Note that nsIGenericFactory.h has been deleted. Links to nsIGenericFactory.h should be replaced by mozilla / ModuleUtils.h
In the example project, #include "nsIClassInfoImpl.h" added.
Now the biggest step is to change the NS_IMPL_NSGETMODULE (which is also deleted), and the components declaration, which is used by this for the whole collection of things found in the sample module . You could use the declaration of components for reference, I did a little help.
The only thing you do not need in this example is declaring and using kSampleCategories . Just replace it with NULL . At least what Benjamin Smedberg said .
The constant kNS_SAMPLE_CID should be replaced with kYOUR_CID_CONSTANT . Just add k to you CID constant name.
Last line:
NS_IMPL_MOZILLA192_NSGETMODULE(&kSampleModule)
Only required for compatibility with Gecko 1.9. Since firefox 3.5 uses this, I think I will leave it.
Component Implementation (CompImpl.cpp)
Link from sample .
- Add the line
NS_IMPL_CLASSINFO... (in sample line 80) - Replace
NS_IMPL_ISUPPORTS1 with NS_IMPL_ISUPPORTS1_CI
There are tons of good examples in this example of how to use I / O values. If you want to use char *, you also need to use nsMemory. I think this is not necessary for nsStrings.
Here we are again going to associate the errors with __imp__moz_xmalloc . This small, very difficult to find article helped get rid of them:
Starting with XULRunner 2.0, the freeze-sensitive adhesive (xpcomglue_s.lib on Windows, libxpcomglue_s.a on Linux and Mac) is dependent on the new functions of error-free memory (mozalloc). Since these procedures did not exist before XULRunner 2.0, XPCOM components that are associated with frozen bond-dependent adhesives will not be compatible with XULRunner applications prior to 2.0.
The solution is to refer to xpcomglue_s_nomozalloc instead (xpcomglue_s_nomozalloc.lib for Windows, libxpcomglue_s_nomozalloc.a on Linux and Mac). This library is new in XULRunner 2.0, and it is identical to xpcomglue_s, except that it is compiled without mozalloc. Just change all references to "xpcomglue_s" in your compiler and linker flags to "xpcomglue_s_nomozalloc". The resulting components of XPCOM will no longer be dependent on mozalloc, and thus will be compatible with XULRunner applications up to 2.0.
A comment. You may also need to create your component using the MOZ_NO_MOZALLOC flag (-DMOZ_NO_MOZALLOC)
And finally, there is no mistake