Re: AccessViolationException

Keith MARSHALL <[email protected]>
Newsgroups gmane.comp.windows.gnu.user
Message-ID <OF719C3D53.1443A4CA-ON8025734B.004EC2B2-8025734B.004FB3A8@total.com>



Michael Ramati wrote:
> gsl_function f;
> f.params = params;
> typedef double (*function_t)(double, void *);
> f.function = (function_t)GetProcAddress(library, name);
> s = gsl_root_fsolver_alloc(gsl_root_fsolver_brent);
>
> // SO FAR SO GOOD :-) that is, memory is OK!
>
> gsl_root_fsolver_set (s, f, 0, 1000);

This *isn't a viable test case -- I can't compile and verify it,
because you give me no clue as to what `library' and `name' are.
Nonetheless, the example given in my GSL Reference Manual suggests
that this final statement should be

  gsl_root_fsolver_set (s, &f, 0, 1000);
                           ^

> // AccessViolationException :-( please HELP!

Probably because you passed the `f' parameter by value, when you
should have passed it by reference, causing `gsl_root_fsolver_set'
to attempt to access memory outside its valid address bounds.

HTH,
Keith.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.