Menu

#286 Access exception calling gsl_qrng_alloc

Gsl
closed
Jerry S.
Binaries (396)
5
2012-07-26
2005-11-26
No

I'm working with some code that
compiles/links/executes OK on Linux with GSL 1.6 or
1.7. On windows with GnuWin32/GSL 1.6, an access
exception occurs when allocating a qasi-RNG (either
type). A simple program that fails is below. The
exception is in libgsl.dll, offset 00099b56, which is
in the code for gsl_qrng_alloc.

Test program compiled with:
gcc qrngTest.c -o qrngTest.exe -lgsl -lgslcblas -lm
Using MinGW.

include <math.h>

include <gsl gsl_qrng.h="">

int main (void) {
gsl_qrng *q;
q = gsl_qrng_alloc(gsl_qrng_sobol, 2 );
return 0;
}

Thanks for any help or workaround.

Dave Collins
dcollins@outbacksoftware.com

Discussion

  • Jerry S.

    Jerry S. - 2006-02-05

    Logged In: YES
    user_id=295275

    If you are using the gsl dll and import libs, you need to
    define GSL_DLL when compiling. Then, all the GSL_VAR and
    GSL_EXPORT qualifiers resolve to __declspec(dllimport).

    I reproduced the crash when compiling under gcc (mingw)
    using the dll's but without -DGSL_DLL. When I included the
    define, your sample code ran fine under all libraries
    (static, static-debug, dll, dll-debug).

    That is, if I compile with:

    gcc qrngTest.c -o qrngTest.exe -Iinclude -Llib -lgsl_dll -
    lgslcblas_dll

    then I get the crash. If I add -DGSL_DLL to the command
    line, then it runs fine.

    If this doesn't solve your problem, please continue the
    discussion.

    Thanks for submitting the bug report!

    Jerry

     
  • Dave Collins

    Dave Collins - 2006-02-08

    Logged In: YES
    user_id=1389792

    Jerry, thanks, you're a lifesaver. That does the trick.