[Issue 8152] New: Linking C library causes Seg-fault
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat May 26 14:27:35 PDT 2012
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: nobody at puremagic.com
ReportedBy: stephan.schiffels at mac.com
--- Comment #0 from Stephan <stephan.schiffels at 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: -------
More information about the Digitalmars-d-bugs
mailing list