From:  "santiago538" <santiago538@yahoo.com>
Date:  25 Oct 2005 07:56:57 Hong Kong Time
Newsgroup:  news.mozilla.org/netscape.public.mozilla.gtk
Subject:  

Re: Segfault trying to embed Mozilla using gtkmozembed

NNTP-Posting-Host:  162.83.77.17

This is only a guess, but your code (as is GTK) is in C, yet you compile it 
as C++ code. (function calls in C++ have their names mangled in order to 
encode their parameters.)

Have you tried renaming your source to moztest.c and compiling it with 
something like:
 gcc \
`gtk-config --libs --cflags` `glib-config --libs --cflags` \
`pkg-config mozilla-gtkmozembed --libs --cflags` \
moztest.c  -o moztest && ./moztest


"Ondaware"  wrote in message 
news:djjpu5$7ki4@ripley.aoltw.net...
> Hi all
>
> I've been trying to embedd mozilla. This is the test file I created.
> Problem is, when I try to run it, it segfaults on the line where it 
> creates the
> new browser (browser = gtk_moz_embed_new();).
>
> Any help would be appreciated.
>
> Thanks in advance.
>
> -----
> This is how I compile it:
>
> g++ \
> `gtk-config --libs --cflags` `glib-config --libs --cflags` \
> `pkg-config mozilla-gtkmozembed --libs --cflags` \
> moztest.cpp -o moztest && ./moztest
>
> --- this is the moztest.cpp file:
>
> #include 
> #include "gtkmozembed.h"
> #include "mozilla-config.h"
> #include 
>
> int main(int argc, char * argv[])
> {
> GtkWidget * window;
> GtkWidget * browser;
>
> gtk_init(&argc, &argv);
>
> window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
>
> printf("Setting up component path.\n");
> fflush(stdout);
>
> gtk_moz_embed_set_comp_path("/usr/lib/mozilla");
>
> printf("Setting up profile.\n");
> fflush(stdout);
>
> gtk_moz_embed_set_profile_path("/safe/users/joao/.mozilla", "mozilla");
>
> printf("Getting browser.\n");
> fflush(stdout);
>
> // browser = gtk_moz_embed_new();
> browser = gtk_moz_embed_new();
>
> printf("Checking browser.\n");
> fflush(stdout);
>
> if(!browser)
> {
> printf("Browser is null.\n");
> fflush(stdout);
> }
>
> gtk_container_add(GTK_CONTAINER(window), browser);
>
> gtk_moz_embed_load_url(GTK_MOZ_EMBED(browser), 
> "http://www.ondaware.com/");
>
> printf("Here.\n");
> fflush(stdout);
>
> gtk_widget_show(window);
>
> gtk_main();
>
> return 0;
> }