Re: Segmentation fault in g_main_context_prepare()
- From: Chris Vine <chris cvine freeserve co uk>
- To: hap 497 <hap497 gmail com>
- Cc: gtk-list gnome org
- Subject: Re: Segmentation fault in g_main_context_prepare()
- Date: Sat, 13 Mar 2010 12:09:15 +0000
On Sat, 13 Mar 2010 01:26:03 -0800
hap 497 <hap497 gmail com> wrote:
> I have a Gtk application. It runs when when I launch it at command
> prompt in a shell.
> But when I try to launch it from another C program, like this:
>
> int main( int argc, const char* argv[] )
> {
> char *args[2] = { "testarg", 0 };
> char *envp[1] = { 0 };
> execve("/home/michael/MyGtkApp",args,envp);
> }
>
> My program crashes with this.
It is difficult to say, but it might be because you have not got the
format of the argv[] array right. The first argument to be passed to
the program is the second member of the argv[] array. The first member
of the array (argv[0]) is conventionally the name of the program, in
your case, MyGtkApp. Possibly you have also carried this misconception
into the program itself and are looking at the wrong members of the
argv[] array for whatever you are doing with them.
If you are not setting an environment you might as well use execv().
Chris
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]