invalid mex-file specified procedure could not be found
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi everyone,
I am trying create a mex file that will use some C code to parse a xml file and return the data to matlab. The C code uses the libxml2 libraries.
The C code compiles and runs fine in visual studio.
When matlab uses the VS compiler (via mex -setup) the mex file will compile fine. How ever when running the mex file I get the following error.
Invalid MEX-file myMexFile: The specified procedure could not be found.
If I remove the line that calls for the file to be parsed (allData = parseFile(docname);) the mex file will run without issue.
I have tried running the mex file through dependency walker and I get a bunch of dll files that are missing. However when removing the parsing code from the mex file I still have dlls missing and the program still runs without any errors.
I think it must be something to do with matlab unable to find library/dll files or finding duplicates and unable to determine which to use.
here is the mexfile code
#include "mex.h" #include "xmlParseFromMex.h"
void mexFunction (int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
int x;
OutputData allData;
double tmp1;
char *docname;
mwSize buflen;
int status;
(void) plhs; /* unused parameters */
/* Check for proper number of input and output arguments */
if (nrhs != 1) {
mexErrMsgTxt("One input argument required.");
}
if (nlhs > 1) {
mexErrMsgTxt("Too many output arguments.");
}
/* Check for proper input type */
if (!mxIsChar(prhs[0]) || (mxGetM(prhs[0]) != 1 ) ) {
mexErrMsgTxt("Input argument must be a string.");
}
buflen = mxGetN(prhs[0])*sizeof(mxChar)+1;
docname = mxMalloc(buflen);
/* Copy the string data into buf. */
status = mxGetString(prhs[0], docname, buflen);
mexPrintf("The input string is: %s\n", docname);
//parse the xml file and returnt he data
allData = parseFile(docname);
mexPrintf("made it this far\n");
mxFree(docname);
x=0;
return;
}
Thanks in advance for your help
0 Kommentare
Antworten (4)
Jan
am 14 Feb. 2014
Where do your store the libxml2 libraries?
How does your command for the mexing look like? Did you specify the library?
1 Kommentar
JEREMIE HABASQUE
am 3 Mär. 2014
Hi,
I have the same problem with a specific mex file.
Invalid MEX-file 'C:\Program
Files\my_file.mexw64': Le
module spécifié est introuvable.
Thanks for any suggestion !
3 Kommentare
JEREMIE HABASQUE
am 5 Mär. 2014
I'm not using libxml2 library. It's a personal mexfile. Here, the file is valid but not found even if the matlab path is correct !
Friedrich
am 5 Mär. 2014
Thats a complete different error. In your case a Module is missing => Missing DLL. For the actual initial problem a procedure is missing => Most likely wrong DLL is pulled which doesnt export the function the code is looking for.
Kristopher
am 3 Mär. 2014
1 Kommentar
Friedrich
am 5 Mär. 2014
You should do a dependency walker runtime profile of MATLAB.exe using the MEX file to see which procedure cannot be bound. That way you can determine the reason for the error. In the case you cannot read the DWI file feel free to attach it to a post and I will have a look.
Siehe auch
Kategorien
Mehr zu Write C Functions Callable from MATLAB (MEX Files) finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!