Hi all,

I try to embed Gecko into an app in order to access to the DOM tree. I take the Gecko 1.8 SDK for linux from http://developer.mozilla.org/en/docs/Gecko_SDK.

I call NS_InitEmbedding() but it fails and returns the code NS_ERROR_NOT_INITIALIZED.

Here is my compilation procedure :
$> g++ -Wall -Wno-non-virtual-dtor -fno-rtti -fno-exceptions -IPATH_TO_GECKO_SDK/include gecko.cc
-LPATH_TO_GECKO_SDK/lib -lembed_base_s -lxpcomglue -ldl -o gecko

how I start my test :
$> ./gecko
apitest running...
NS_InitEmbedding FAILED (rv = 0xc1f30001)
NS_TermEmbedding FAILED (rv = 0xc1f30001)
apitest complete

I may also the specify a path as a first arg for NS_InitEmbedding() and give PATH_TO_GECKO_SDK/lib, but I've got the same result...

what is missing ? what I do wrong ?

Thx. Olivier.

Here is my code:
#include <stdio.h>

#include <xpcom-config.h>
#include <nsEmbedAPI.h>
#include <nsEmbedString.h>
#include <nsCOMPtr.h>

int main(int argc, char *argv[]) {
    char *pszBinDirPath = nsnull;
    nsresult rv;

    if (argc > 1) {
        pszBinDirPath = argv[1];
    }
    printf("apitest running...\n");

    nsCOMPtr<nsILocalFile> binDir=nsnull;
    if( pszBinDirPath )
        NS_NewLocalFile(nsEmbedString((const PRUnichar*)pszBinDirPath),
                                        PR_TRUE, getter_AddRefs(binDir));

    rv = NS_InitEmbedding(binDir, nsnull);
    if (NS_FAILED(rv)) {
        printf("NS_InitEmbedding FAILED (rv = 0x%08x)\n", rv);
        // DROP THROUGH - NS_TermEmbedding should cope
    }
    else {
        printf("NS_InitEmbedding SUCCEEDED (rv = 0x%08x)\n", rv);
    }

    rv = NS_TermEmbedding();
    if (NS_FAILED(rv)) {
        printf("NS_TermEmbedding FAILED (rv = 0x%08x)\n", rv);
        // DROP THROUGH
    }
    else {
        printf("NS_TermEmbedding SUCCEEDED (rv = 0x%08x)\n", rv);
    }

    printf("apitest complete\n");

    return 0;
}
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to