www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Problem interfacing with GSL

reply "Arjan" <arjanf hotmail.com> writes:
Hi!
D noob here.
I'm trying to call this function from the GSL lib:

double gsl_stats_long_double_mean (const long double [], const 
size_t, const size_t);

linking with: -L-lgsl -L-lgslcblas -L-lm

I have tried different configurations, refering to
http://dlang.org/interfaceToC.html and the forums, but it always 
gives me probems like,
calling it the wrong way or segmentation falt.
Can anyone help?

Arjan
Nov 30 2014
next sibling parent reply "John Colvin" <john.loughran.colvin gmail.com> writes:
On Sunday, 30 November 2014 at 12:21:51 UTC, Arjan wrote:
 Hi!
 D noob here.
 I'm trying to call this function from the GSL lib:

 double gsl_stats_long_double_mean (const long double [], const 
 size_t, const size_t);

 linking with: -L-lgsl -L-lgslcblas -L-lm

 I have tried different configurations, refering to
 http://dlang.org/interfaceToC.html and the forums, but it 
 always gives me probems like,
 calling it the wrong way or segmentation falt.
 Can anyone help?

 Arjan
the correct signature in D for that would be: import core.std.config; double gsl_stats_long_double_mean(const(c_long_double)*, const size_t, const size_t);
Nov 30 2014
parent "Arjan" <arjanf hotmail.com> writes:
On Sunday, 30 November 2014 at 13:09:15 UTC, John Colvin wrote:
 On Sunday, 30 November 2014 at 12:21:51 UTC, Arjan wrote:
 Hi!
 D noob here.
 I'm trying to call this function from the GSL lib:

 double gsl_stats_long_double_mean (const long double [], const 
 size_t, const size_t);

 linking with: -L-lgsl -L-lgslcblas -L-lm

 I have tried different configurations, refering to
 http://dlang.org/interfaceToC.html and the forums, but it 
 always gives me probems like,
 calling it the wrong way or segmentation falt.
 Can anyone help?

 Arjan
the correct signature in D for that would be: import core.std.config; double gsl_stats_long_double_mean(const(c_long_double)*, const size_t, const size_t);
I admit i was far from getting it right :), and was unaware of core.std.config functionalities. Thanks! Arjan.
Nov 30 2014
prev sibling parent reply Joseph Rushton Wakeling via Digitalmars-d-learn writes:
On 30/11/14 13:21, Arjan via Digitalmars-d-learn wrote:
 Hi!
 D noob here.
 I'm trying to call this function from the GSL lib:
Out of curiosity (since your question has already been answered), what functionality is it that is making you want to use GSL? I ask because I want to be sure we're not missing something we ought to have in Phobos.
Nov 30 2014
parent reply "Arjan" <arjanf hotmail.com> writes:
On Sunday, 30 November 2014 at 16:26:53 UTC, Joseph Rushton 
Wakeling via Digitalmars-d-learn wrote:
 On 30/11/14 13:21, Arjan via Digitalmars-d-learn wrote:
 Hi!
 D noob here.
 I'm trying to call this function from the GSL lib:
Out of curiosity (since your question has already been answered), what functionality is it that is making you want to use GSL? I ask because I want to be sure we're not missing something we ought to have in Phobos.
I'm taking a course in "statistical inference and uncertainty", since I'm learning D, i thought I'd do some numerical computing in it. Does there exist a library so I can stick in D only?
Dec 01 2014
parent "John Colvin" <john.loughran.colvin gmail.com> writes:
On Monday, 1 December 2014 at 12:17:46 UTC, Arjan wrote:
 On Sunday, 30 November 2014 at 16:26:53 UTC, Joseph Rushton 
 Wakeling via Digitalmars-d-learn wrote:
 On 30/11/14 13:21, Arjan via Digitalmars-d-learn wrote:
 Hi!
 D noob here.
 I'm trying to call this function from the GSL lib:
Out of curiosity (since your question has already been answered), what functionality is it that is making you want to use GSL? I ask because I want to be sure we're not missing something we ought to have in Phobos.
I'm taking a course in "statistical inference and uncertainty", since I'm learning D, i thought I'd do some numerical computing in it. Does there exist a library so I can stick in D only?
http://code.dlang.org/packages/dstats
Dec 01 2014