3 ms·
One thing that jumped out to me, and I haven't worked with Rust FFI enough to know this answer. Is the C library necessary? Since Rust is exporting the C interf
by bluejekyll 11y ago
One thing that jumped out to me, and I haven't worked with Rust FFI enough to know this answer. Is the C library necessary? Since Rust is exporting the C interfaces directly, couldn't Matlab link directly against that?
- masklinn 11y agoIt would also require generating the Matlab bindings for Rust, but more problematically it seems to use a special compiler/linker (`mex`). I don't know if that does genuine work of if it's just a wrapper/synchronizer around compilers and linkers which you could do without.
- dsharlet 11y agoThe main thing mex does is let you link to the matlab API libraries that are otherwise hard to get. To work around this, I like to just grab the API directly from the calling process via dlsym/GetProcAddress. That way, you can build mex libraries with any toolchain you want, even without matlab installed.
- marmaduke 11y agoThis can be non-portable because the mex header will expand certain function calls to specific implementations depending on the mex options you use. I seem to recall e.g. mxGetM expanded to mxGetM700 in one version.