I tried adding PySys_SetArgv(argc, argv); after Py_Initialize(); It gets me further but then gives a strange error message:
Loading the Sage library... ------------------------------------------------------------ Unhandled SIGSEGV: A segmentation fault occurred in Sage. This probably occurred because a *compiled* component of Sage has a bug in it (typically accessing invalid memory) or is not properly wrapped with _sig_on, _sig_off. You might want to run Sage under gdb with 'sage -gdb' to debug this. Sage will now terminate (sorry). ------------------------------------------------------------ On Sep 13, 2:32 pm, Willem Jan Palenstijn <w...@usecode.org> wrote: > On Tue, Sep 13, 2011 at 06:10:45AM -0700, Michael Rubinstein wrote: > > Example 2 > > ---------------- > > > Next thing I tried to do was to embed sage in a c program, by > > following > >http://docs.python.org/extending/embedding.html > > but that gave me errors at runtime. > > > For example, the following embed.c progam produced the output/errors at the > > bottom of this post. Any ideas what's wrong? Any ideas of better ways to > > call > > sage from within c or c++? > > Some quick googling suggests you may have to call PySys_SetArgv[Ex] > (http://docs.python.org/c-api/init.html#PySys_SetArgvEx) to set up sys.argv > after calling Py_Initialize(). I haven't actually tried it, though. > > -Willem Jan -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org