This is my script to get an initial embedding distribution on Mac OS X
(using seamonkey-1.0.7):

=======
#!/bin/sh

app=seamonkey-1.0.7
distfile=$app.source.tar.bz2
subapp=suite

cat <<END > mozconfig-$app
mk_add_options MOZ_CO_PROJECT=$subapp
ac_add_options --enable-debug
ac_add_options --enable-application=$subapp
END

rm -rf mozilla
tar jxvf $distfile

cp mozconfig-$app mozilla/mozconfig
cd mozilla && ./configure && make && cd embedding/config && make
cd ../../.. && rsync -av mozilla/dist/Embed/. .   # copy dist to here
=======

The script runs successfully.  Next task is to initialize the
embedding in my own app:

http://developer.mozilla.org/en/docs/Roll_your_own_browser_-_An_embedding_HowTo#What_initializations_do_I_have_to_do.3F

However this web page gives the function

    nsresult NS_InitEmbedding(const char *aPath);

whereas mozilla/dist/sdk/include/nsEmbedAPI.h has

    extern "C" NS_HIDDEN NS_METHOD
    NS_InitEmbedding(nsILocalFile *aMozBinDirectory,
                     nsIDirectoryServiceProvider *aAppFileLocProvider,
                     nsStaticModuleInfo const *aStaticComponents =
nsnull,
                     PRUint32 aStaticComponentCount = 0);

OK, no big deal since it says I can pass nsnull as the second
parameter.  Per the instructions in nsEmbedAPI.h, I use
NS_NewLocalFile() to create the path:

=======
#include <stdio.h>

#include "xpcom-config.h"
#define XPCOM_GLUE 1

#include "nsEmbedAPI.h"
#include "nsCOMPtr.h"
#include "nsStringAPI.h"
#include "nsComponentManagerUtils.h"
#include "nsXPCOM.h"

int main()
{
    nsILocalFile* path = nsnull ;
    nsresult path_result = NS_NewLocalFile(NS_LITERAL_STRING("."),
PR_FALSE, &path) ;
    fprintf(stderr, "path_result: %x\n", path_result) ;
    fprintf(stderr, "path: %x\n", path) ;

    nsresult init_result = NS_InitEmbedding(path, nsnull) ;
    fprintf(stderr, "init_result: %x\n", init_result) ;

    nsresult term_result = NS_TermEmbedding() ;
    fprintf(stderr, "term_result: %x\n", term_result) ;

    return 0 ;
}
=======
% make
g++ -I /Developer/Headers/FlatCarbon  -Imozilla/dist/sdk/include  -
fpascal-strings -DDEBUG=1 -DTARGET_API_MAC_CARBON=1 -g -Wall -Wunused -
Wconversion  -arch i386 -c -o mytest.o mytest.cpp
g++ -fpascal-strings -DDEBUG=1 -DTARGET_API_MAC_CARBON=1 -g -Wall -
Wunused -Wconversion  -arch i386   mytest.o   mozilla/dist/sdk/lib/
libembed_base_s.a mozilla/dist/sdk/lib/libxpcomglue.a  -o mytest    -
framework Carbon -framework ApplicationServices
=======
% ./mytest
path_result: c1f30001
path: 0
Bus error
=======

Googling for 0xc1f30001, I find that it means
NS_ERROR_NOT_INITIALIZED.  It appears that I need to create an
nsILocalFile in order to call NS_InitEmbedding(), but in order to do
so I need to have the embedding initialized!

Maybe this is a simple problem?  Any help would be appreciated.

Also, if you've read this far already, perhaps you wouldn't mind
telling me if you think it's feasible to embed an interactive Flash
player (via the mozilla Flash plugin) inside an app for Mac OS X?

Regards,
Jeff

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

Reply via email to