'loadlibrary' - .h file problem.

3 次查看(过去 30 天)
Arwel
Arwel 2018-3-14
Hi
I have a shared c library that I would like to load into Matlab with 'loadlibrary'. The .h file looks like this...
#define NESTRUN __nested_MOD_nestrun
/***************************************** C Interface to MultiNest **************************************************/
extern void NESTRUN(int *, int *, int *, int *, double *, double *, int *, int *, int *, int *, int *, double *,
char *, int *, int *, int *, int *, int *, int *, double *, int *, void (*Loglike)(double *, int *, int *,
double *, void *), void (*dumper)(int *, int *, int *, double **, double **, double **, double *,
double *, double *, double *, void *), void *context);
void run(int IS, int mmodal, int ceff, int nlive, double tol, double efr, int ndims, int nPar, int nClsPar,
int maxModes, int updInt, double Ztol, char root[], int seed, int *pWrap, int fb, int resume, int outfile,
int initMPI, double logZero, int maxiter, void (*LogLike)(double *, int *, int *, double *, void *),
void (*dumper)(int *, int *, int *, double **, double **, double **, double *, double *, double *, double *, void *),
void *context)
{
int i;
for (i = strlen(root); i < 100; i++) root[i] = ' ';
NESTRUN(&IS, &mmodal, &ceff, &nlive, &tol, &efr, &ndims, &nPar, &nClsPar, &maxModes, &updInt, &Ztol,
root, &seed, pWrap, &fb, &resume, &outfile, &initMPI, &logZero, &maxiter, LogLike, dumper, context);
}
However, when I try 'loadlibrary' I get the following result.....
>> loadlibrary('/usr/local/lib/libmultinest.so','multinest.h')
Error using loadlibrary
/tmp/tpcc01f289_311e_4350_b966_3ac536132665/libmultinest_thunk_glnxa64.so: undefined symbol: __nested_MOD_nestrun
So, what am I doing wrong, and why is Matlab not picking up on the #define? ('multinest.h' is in my current working directory btw....)
Cheers,
Arwel

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Call C from MATLAB 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by