May 04, 2004 Calling CBLAS with enums | ||||
|---|---|---|---|---|
| ||||
I am trying to call a CBLAS routine from my D program. The C function requires some enums, and I'm not sure how to do this. I thought I could just define the enums in my D code, like this:
extern (C) enum CBLAS_ORDER
{CblasRowMajor=101, CblasColMajor=102 };
extern (C) enum CBLAS_TRANSPOSE
{CblasNoTrans=111, CblasTrans=112, CblasConjTrans=113, AtlasConj=114};
extern (C) cblas_dgemm( CBLAS_ORDER Order, CBLAS_TRANSPOSE TransA,
CBLAS_TRANSPOSE TransB, int M, int N,
int K, double alpha, double *A,
int lda, double *B, int ldb,
double beta, double *C, int ldc);
(I wasn't sure whether I needed the extern(C) for the enums, so I tried with and without.)
I am getting this error when I compile:
linearalgebra.d(7): found 'Order' when expecting ')'
linearalgebra.d(7): semicolon expected, not 'TransA'
linearalgebra.d(7): no identifier for declarator
What am I doing wrong?
Drew
| ||||
May 04, 2004 Re: Calling CBLAS with enums | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Drew McCormack | Sorry, I'm really dumb. I see I left out the 'void' in the function signature :-(
Drew
On 2004-05-04 15:20:53 +0200, Drew McCormack <drewmccormack@mac.com> said:
>
> I am trying to call a CBLAS routine from my D program. The C function requires some enums, and I'm not sure how to do this. I thought I could just define the enums in my D code, like this:
>
> extern (C) enum CBLAS_ORDER
> {CblasRowMajor=101, CblasColMajor=102 };
> extern (C) enum CBLAS_TRANSPOSE
> {CblasNoTrans=111, CblasTrans=112, CblasConjTrans=113, AtlasConj=114};
>
> extern (C) cblas_dgemm( CBLAS_ORDER Order, CBLAS_TRANSPOSE TransA,
> CBLAS_TRANSPOSE TransB, int M, int N,
> int K, double alpha, double *A,
> int lda, double *B, int ldb,
> double beta, double *C, int ldc);
>
>
> (I wasn't sure whether I needed the extern(C) for the enums, so I tried with and without.)
> I am getting this error when I compile:
>
> linearalgebra.d(7): found 'Order' when expecting ')'
> linearalgebra.d(7): semicolon expected, not 'TransA'
> linearalgebra.d(7): no identifier for declarator
>
>
> What am I doing wrong?
>
> Drew
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply