http://d.puremagic.com/issues/show_bug.cgi?id=8152
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 AssignedTo: nob...@puremagic.com ReportedBy: stephan.schiff...@mac.com --- Comment #0 from Stephan <stephan.schiff...@mac.com> 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. gsltest.d -------------------------- 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 / 0.025); writeln(ret); } --------------------------- 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. Stephan -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------