Summary: Linking C library causes Seg-fault
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Stephan <> 2012-05-26 14:29:20 PDT 
The following program tries to trivially run a function from the GSL. It
compiles, but generates a segmentation fault when run.

import std.stdio;

extern (C) double gsl_sf_hyperg_2F1(double a, double b, double c,
double x);

void main() {
  double f = 0.0025;
  auto ret = f * gsl_sf_hyperg_2F1(1.0, 10.0, 11.0, 1.0 - f /

The program should return 0.015681, which is the
numerically correct result. Note that the bug can not be in the GSL itself, as
it works correctly when used with C or C++.

To compile and run the code, I used the following command line:

rdmd -L-L/opt/local/lib -L-lgsl -L-lgslcblas gsltest.d
(assuming that gel libraries are in /opt/local/lib)

This seems to be a bug related to how C library functions are called from D.


Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to