Hello everyone! I'm working on a game and I need to build a DLL that compiles 3 libraries and runs a tempo extraction program using the libraries. I've taken a few cracks at compiling the tempo extraction program already, but I don't think I've linked the libraries correctly to do so. I really have very little experience with C, but I do need to write the DLL in C so I can access it from AS3.
Here is the code:
Code:
// matlib.h
#ifndef MATLIB_H
#define MATLIB_H
#ifndef REAL
# define REAL double
#endif
// TODO change gemm to cblas_rgemm sameting for others..
#if REAL == double //errors here
# define gemm cblas_dgemm
# define gemv cblas_dgemv
# define cblas_rgemm cblas_dgemm
# define cblas_rcopy cblas_dcopy
# define mxIsReal mxIsDouble
#else
# define gemm cblas_sgemm
# define gemv cblas_sgemv
# define cblas_rgemm cblas_sgemm
# define cblas_rcopy cblas_scopy
# define mxIsReal mxIsSingle
#endif
struct aspl_mat{
REAL * data;
int rs;
int cs;
int ld;
char owner;
};
typedef struct aspl_mat aspl_mat;
struct aspl_mda{ // multi dimentional array
REAL * data;
int nd;
int * sz;
char owner;
};
typedef struct aspl_mda aspl_mda;
// void randMat( REAL *mat, const int m, const int n, const int stride );
// void fillMat( REAL *mat, const int m, const int n, const int stride, REAL val );
// void printMat( const REAL *mat, const int m, const int n, const int stride );
// REAL* newMat( const int m, const int n );
aspl_mat * newMat( const int rs, const int cs );
aspl_mat * cpyMat( aspl_mat * mat );
void freeMat( aspl_mat * mat );
aspl_mat * fillMat( aspl_mat * mat, REAL val );
aspl_mat * printMat( aspl_mat *mat );
void infoMat( aspl_mat *mat );
aspl_mat * randMat( aspl_mat *mat );
aspl_mat * toMat( REAL* data, int rs, int cs, int ld );
aspl_mat * absCMat( aspl_mat * abs, aspl_mat * mat );
int getMatCount( );
aspl_mat * sliceMat( aspl_mat * mat, int rowStart, int rowIncr, int rowCount, int colStart, int colIncr, int colCount );
void plotRow( aspl_mat * mat, int maxChar );
aspl_mat * transposeMat( aspl_mat * mat );
void statsMat( aspl_mat * mat );
aspl_mda * newMda( int nd, int * sz );
aspl_mat * mda2mat( aspl_mda * mda, int freeMda );
aspl_mda * readMda( const char * path );
aspl_mda * mat2mda( aspl_mat * mat, int free_mat );
void writeMda( const aspl_mda * mda, const char * path );
void printMda( aspl_mda * mda );
void infoMda( aspl_mda * mda );
void freeMda( aspl_mda * mda );
int numelMda( const aspl_mda * mda );
void ewAdd( const aspl_mat * mat, const REAL a );
void ewMul( const aspl_mat * mat, const REAL a );
void ewTanh( const aspl_mat * mat );
void ewSigmoid( const aspl_mat * mat );
REAL maxMat( aspl_mat * mat );
REAL minMat( aspl_mat * mat );
aspl_mat * aspl_rgemm( enum CBLAS_TRANSPOSE transA, aspl_mat * A,
enum CBLAS_TRANSPOSE transB, aspl_mat * B,
REAL alpha, REAL beta, aspl_mat * C );
#endif
I'm getting a simple C1017 error, but I can't seem to give REAL a value at the proper place. My inexperience with C is preventing me from diagnosing exactly what this header SHOULD be doing, so I'm lost with exactly why it's not working.
Would anyone here know some of steps that would enable me to build the DLL (ranging from linking the library to the tempo extraction program to building the DLL itself)? Any help would be greatly appreciated! Thanks!