GNU Scientific Library in D

Lars Kyllingstad public at kyllingen.net
Mon Jul 23 13:53:32 PDT 2007


Tomas Lindquist Olsen Wrote:

> On Mon, 23 Jul 2007 14:05:19 -0400, Lars Kyllingstad wrote:
> 
> > Hello,
> > 
> > I would like to use the GNU Scientific Library, which is written in C, in
> > D. While converting the header files to D modules, however I ran in to the
> > following problem. In gsl_math.h, the following (crucially important)
> > struct is defined:
> > 
> > struct gsl_function_struct
> > {
> >   double (* function) (double x, void * params); void * params;
> > };
> > 
> > Note that the first member is named 'function', which unfortunately is a
> > keyword in D. Any suggestions as to how I can work around this?
> > 
> > -Lars
> 
> Renaming it to func or something else in you D header is not going to
> break anything.
> 
> -Tomas

Thanks a lot, worked like a charm. But out of curiosity I would like to know why. Aren't the functions in the GSL libraries expecting a field named 'function' there? Or don't the names of the fields matter at all, as long as the structure is the same?

-Lars



More information about the Digitalmars-d mailing list