mex crashes when adding input AND calling function
Show older comments
My mex file crashes only when I provide an input AND call a function. I'm having a hard time figuring out what is actually going on. Here is a shortened version of the code that reproduces the behavior.
Definitions of the library I am calling can be found at:
I can include them here if it turns out to be relevant.
Code from void mex
double *option;
long *nRecords;
int *x, *y;
int file_handle_value;
wchar_t *path = L"MY_PATH";
ADIResultCode result;
ADI_FileHandle fileH(0); //Pointer to ADI_FileHandle__
option = mxGetPr(prhs[0]);
result = ADI_OpenFile(path, &fileH, kOpenFileForReadOnly);
//printf("Result: [s[%d]]
//printf("Result: %x\n",result);
if (result == 0)
{
printf("unused: %d\n",fileH->unused);
//Size 4 - not sure if this will change to 8 ...
//Might need to have a check ...
//printf("pointer size: %d\n",sizeof(fileH));
printf("pointer_value: %d\n",fileH);
}
//Uncommenting this call crashes Matlab, but only if option line is uncommented as well
//result = ADI_GetNumberOfRecords(fileH,nRecords);
Call line:
sdk_test(0) %Name of the mex file
Crashes when option AND second result are both uncommented, but not one or the other
1 Comment
Jim Hokanson
on 1 Apr 2014
Accepted Answer
More Answers (0)
Categories
Find more on Code Performance in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!