Binding to GSL library

Artur Skawina via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Nov 26 10:45:23 PST 2015


On 11/25/15 17:11, Radek via Digitalmars-d-learn wrote:
> Hi, I'm making a trying to bind a gsl library http://www.gnu.org/software/gsl/ so far it was working but when i started binding complex numbers some functions won't work, like trigonometric functions - called they return null.
> 
> in gsl code complex struct looks like:
> 
> typedef struct
>   {
>     double dat[2];
>   }
> gsl_complex;
> 
> 
> my complex struct looks like that:
> 
> struct _gsl_complex {
>   double dat[2];
> }
> alias gsl_complex = _gsl_complex*;
> 
> So, what im doing wrong?

That's not a struct but a pointer to a struct.

Also, you can just drop the `typedef` hack (which is used
in C to avoid having to type the 'struct' keyword), so:

   struct gsl_complex {
      double[2] dat;
   }

artur


More information about the Digitalmars-d-learn mailing list