Interfacing Julia & Red + error with julia 0.6.rc3

In my quests to a possible GUI toolkits I found Red that has an interesting GUI system though far from conventional. I asked a couple questions in Red gitter and several people started to be interested. Such that one person wrote a prototype to call Julia from Red.
But here started one issue that I want to report here before opening a ticket (if appropriate).

The issue is that prototype works well for Julia 0.5 but fails silently for 0.6. Several messages in Gitter but this one pictures it all.
As it is this seams a error from the Julia side so I thought this was of interest to report here.
Warning, Red is currently a 32 bits product so to reproduce the above one has to use a (Windows) 32 bits Julia version.

1 Like

What problems are you reporting and with which version? I don’t think anyone is going to jump through so many hoops to debug a problem like this. Here’s some example code using Python CFFI, available in miniconda, if you want to test variations and make a reduced case (I tried with 0.6-rc3 on win32 and got a stackoverflow). Note that

  • on Python 3, you need jl_init(b"C:/path/...") to get correct conversion.
  • the signature of jl_init has changed in 0.6 (see other posts with the embedding tag)
  • you probably need julia/bin/ in your PATH, or simply start python in the julia/bin directory
from cffi import FFI
ffi = FFI()
ffi.cdef("""
  void jl_init(); // void jl_init(const char* s); for 0.5
""")

C = ffi.dlopen("C:/path/to/libjulia.dll")
C.jl_init()

(as an aside, something that is a win32-only is absolutely a non-starter as far as GUI or anything else goes)

Ok, I’ll debug further when I have a chance, but opened an issue for now about the stackoverflow:

https://github.com/JuliaLang/julia/issues/22320

Red is multi-platform - it’s just that GUI support is farthest along for Windows. OS X is almost done, and Linux has been started.

Two small things:

  • why do you think Red GUI system is far from conventional? The systems i know closer all provide configuration by data (xml, json, etc.)
  • What other possible GUI toolkits you did meet in your quest?

Well, I was referring more to the Red language.
Regarding other GUI toolkits, I put a lot of work in IUP, which I kind of drop due to difficulties in working with its documentation. Also gave a try to Libui but what seamed a very promising toolkit suddenly stalled the development (almost a year) .

If you want to play a bit with Red I created this repo. Had not time to try it more than the two examples in the page.

@joa-quim @asampal compiling the executable with a stack size of 8MB should fix the problem for now.

Thanks. I’ll wait till #22254 is merged but will also pass along this info in case the Red compiler can take that into account.

HI @ihnorton
I am having similar issues when trying to init julia from python(using pyjulia)
Can you elaborate on the steps necessary to get it to work?

Do I need to build julia from source?

The stack size of the python executable driving pyjulia needs to be increased, which can be done with editbin (unfortunately only available with the Visual Studio SDK – free, but a bit of a download):

(note: some of the PE editor tools might be able to serve the same function, but I can’t recommend a specific one)

No.

Not sure if you are the same person who posted about this on GitHub, but if not, see below for confirmed solution using editbin:

https://github.com/JuliaLang/julia/issues/22866

It’s me yes.
The solution works.
Thanks.