Open btalberg opened 4 years ago
Change mxArrayToStringRobust in gasonMex.cpp to:
char* mxArrayToStringRobust( const mxArray *M ) {
#ifdef HAVE_OCTAVE
return mxArrayToString(M);
#else
// convert Matlab string to char* (robust version of mxArrayToString)
if(!mxIsChar(M)) mexErrMsgTxt("String expected.");
ushort *c=(ushort*) mxGetData(M); char* str; siz n;
n=mxGetNumberOfElements(M); str=(char*) mxMalloc(n+1);
for( siz i=0; i<n; i++ ) str[i]=c[i]; str[n]=0; return str;
#endif
}
then recompile the code:
$ cd path_of_private
$ CXXFLAGS="-std=c++11 -Wall -fPIC -I../../common" mkoctfile --mex -DMATLAB_MEX_FILE -g gasonMex.cpp ../../common/gason.cpp
$ CFLAGS="-std=c11 -Wall -fPIC -I../../common" mkoctfile --mex -DMATLAB_MEX_FILE -v -g maskApiMex.c ../../common/maskApi.c
It is work for me,I hope that can help !
Anyone have experience running the cocoapi with Octave? I'm struggling using the gason library. I'm running on OX 10.15.3, using Octave version 5.2.0 (installed using brew). I'm able to compile the gasonMex binary using:
When I try the example in the gason.m file, I'm seeing the following:
Tried a few other JSON strings as well:
Any suggestions/insights?