Embedding Julia in Matlab

Apparently other people have problems on Windows (which I believe is the twadleigh’s primary platform). Given the unclear nature of that linux issue, and a number of conversations about memory handling and interrupts in the past when I have looked at this, I suspect there are problems here which are too deep to debug by proxy. I just looked through some of the code and took a few notes:

  • Very hard to understand the flow of control and design decisions here.
  • A number of suspicious (or at least odd) uses of unsafe_wrap in the array handling Julia code.
  • Only two of the rooted arguments here are used (but jl_call2 roots all of its arguments anyway) – maybe harmless, but a code smell.

Given the state of the code, if I was working on this, I would start from close to scratch (possibly using loadlibrary rather than mex) and do some minimal experiments first: basic code eval, wrapping arrays and type conversion for a small number of types, etc. That’s the only way I would feel sufficiently informed to judge whether and how to clean-up versus rebuild.