On Sat, Oct 07, 2006 at 08:30:50PM +0200, Ivan Liu wrote: > Hi, > > I hope to use to declare a gsl_function by pointer, and > use the integration rountine gsl_integration_qag in the > following way: > > > gsl_function * Integrand=0; > Integrand->function = &f; > Integrand->params = &list; > > gsl_integration_qag (Integrand, x_start, x_end, epsabs, epsrel, limit, 1, > w, &resIntegral, &abserr);
There may be other problems, but for starters, you should allocate some memory for your Integrand to point to. gsl_function * Integrand= malloc(sizeof(gsl_function)); Integrand->function = &f; Integrand->params = &list; ... free(Integrand) Also, in the future, you might consider looking into the basics of the GNU debugger. If you compile your code with the -g option (and no optimization flags) then $ gdb <your program> ... > run argv[1] argv[2] ... Will run your program and show you what line triggered the segfault, as well as what the stack looked like at the point of the crash, variable values, etc. Best of luck, James -- http://www-etud.iro.umontreal.ca/~bergstrj _______________________________________________ Help-gsl mailing list Help-gsl@gnu.org http://lists.gnu.org/mailman/listinfo/help-gsl