[EMAIL PROTECTED] wrote:
I am attempting to instantiate an XPCOM component in simple C++
application. The goal is to write unit tests for my XPCOM component.
The XPCOM instantiation always fails. Here is my instantiation code:

int main(int argc, char *argv[]) {
        if (argc == 1) {
                printf("Usage: XPCOMTest <contract_id> [<contract_id]*\n");
                return 0;
        }
        XPCOMTest testObj;

You have never initialized XPCOM! You cannot create XPCOM objects (or call almost any XPCOM functions, for that matter) until you have called NS_InitXPCOM2 (or NS_InitXPCOM3).

My platform is Linux, FC3, I am linking against the following
libraries:
-lxpcomglue -lnspr4 -lplds4

Which linking strategy are you trying to use? This looks like a mishmash of the "standalone" strategy with -lxpcomglue and the "dependent" strategy.

http://developer.mozilla.org/en/docs/XPCOM_Glue

I have set the LD_LIBRARY_PATH to the "components" directory of my
Mozilla installation.

This should not be necessary. It probably *will* be necessary to launch your application with the run-mozilla.sh script to set up LD_LIBRARY_PATH to point to the application directory and possibly set MOZILLA_FIVE_HOME.

--BDS
_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom

Reply via email to