# Interfacing Julia & Red + error with julia 0.6.rc3

**URL:** <https://discourse.julialang.org/t/interfacing-julia-red-error-with-julia-0-6-rc3/4180>\
**Category:** General Usage\
**Tags:** embedding\
**Created:** [June 9, 2017, 3:57pm UTC](https://discourse.julialang.org/t/interfacing-julia-red-error-with-julia-0-6-rc3/4180 "2017-06-09T15:57:13Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [June 9, 2017, 3:57pm UTC](https://discourse.julialang.org/t/interfacing-julia-red-error-with-julia-0-6-rc3/4180/1 "2017-06-09T15:57:13Z")

</div>

In my quests to a possible GUI toolkits I found [Red](http://www.red-lang.org/) 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](https://gist.github.com/Oldes/61444afa55a0395fde60002a5b345518) 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](https://gitter.im/red/red?at=593a88c602c480e672294328) 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.

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ihnorton/32/26_2.png) [@ihnorton](https://discourse.julialang.org/u/ihnorton)\
**Post date:** [June 10, 2017, 3:36am UTC](https://discourse.julialang.org/t/interfacing-julia-red-error-with-julia-0-6-rc3/4180/2 "2017-06-10T03:36:07Z")

</div>

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

```julia
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)

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ihnorton/32/26_2.png) [@ihnorton](https://discourse.julialang.org/u/ihnorton)\
**Post date:** [June 10, 2017, 4:08am UTC](https://discourse.julialang.org/t/interfacing-julia-red-error-with-julia-0-6-rc3/4180/3 "2017-06-10T04:08:59Z")

</div>

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](https://github.com/JuliaLang/julia/issues/22320)

---

<div class="post-metadata">

**Author:** ![asampal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/asampal/32/253_2.png) [@asampal](https://discourse.julialang.org/u/asampal)\
**Post date:** [June 11, 2017, 5:48am UTC](https://discourse.julialang.org/t/interfacing-julia-red-error-with-julia-0-6-rc3/4180/4 "2017-06-11T05:48:30Z")

</div>

> [@ihnorton](#):
>
> something that is a win32-only is absolutely a non-starter as far as GUI or anything else goes

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.

---

<div class="post-metadata">

**Author:** ![lobingera](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lobingera/32/211_2.png) [@lobingera](https://discourse.julialang.org/u/lobingera)\
**Post date:** [June 11, 2017, 2:26pm UTC](https://discourse.julialang.org/t/interfacing-julia-red-error-with-julia-0-6-rc3/4180/5 "2017-06-11T14:26:04Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [June 11, 2017, 3:47pm UTC](https://discourse.julialang.org/t/interfacing-julia-red-error-with-julia-0-6-rc3/4180/6 "2017-06-11T15:47:14Z")

</div>

Well, I was referring more to the Red language.  
Regarding other GUI toolkits, I put a lot of work in [IUP](https://github.com/joa-quim/IUP.jl), which I kind of drop due to difficulties in working with its documentation. Also gave a try to [Libui](https://github.com/joa-quim/Libui.jl) 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](https://github.com/joa-quim/Red.jl). Had not time to try it more than the two examples in the page.

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ihnorton/32/26_2.png) [@ihnorton](https://discourse.julialang.org/u/ihnorton)\
**Post date:** [June 12, 2017, 9:43pm UTC](https://discourse.julialang.org/t/interfacing-julia-red-error-with-julia-0-6-rc3/4180/7 "2017-06-12T21:43:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [June 12, 2017, 11:09pm UTC](https://discourse.julialang.org/t/interfacing-julia-red-error-with-julia-0-6-rc3/4180/8 "2017-06-12T23:09:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Ron\_Zaidman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ron_zaidman/32/5893_2.png) [@Ron\_Zaidman](https://discourse.julialang.org/u/Ron_Zaidman)\
**Post date:** [July 19, 2017, 10:19am UTC](https://discourse.julialang.org/t/interfacing-julia-red-error-with-julia-0-6-rc3/4180/9 "2017-07-19T10:19:24Z")

</div>

> [@ihnorton](#):
>
> ompiling the executable with a stack size of 8MB should fix the problem for now.

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?

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ihnorton/32/26_2.png) [@ihnorton](https://discourse.julialang.org/u/ihnorton)\
**Post date:** [July 19, 2017, 1:17pm UTC](https://discourse.julialang.org/t/interfacing-julia-red-error-with-julia-0-6-rc3/4180/10 "2017-07-19T13:17:00Z")

</div>

> [@Ron\_Zaidman](#):
>
> Can you elaborate on the steps necessary to get it to work?

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):

> <https://stackoverflow.com/questions/20744650/how-to-overcome-stack-size-issue-with-visual-studio-running-c-codes-with-big-ar>

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

> [@Ron\_Zaidman](#):
>
> Do I need to build julia from source?

No.

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ihnorton/32/26_2.png) [@ihnorton](https://discourse.julialang.org/u/ihnorton)\
**Post date:** [July 19, 2017, 1:26pm UTC](https://discourse.julialang.org/t/interfacing-julia-red-error-with-julia-0-6-rc3/4180/11 "2017-07-19T13:26:07Z")

</div>

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](https://github.com/JuliaLang/julia/issues/22866)

---

<div class="post-metadata">

**Author:** ![Ron\_Zaidman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ron_zaidman/32/5893_2.png) [@Ron\_Zaidman](https://discourse.julialang.org/u/Ron_Zaidman)\
**Post date:** [July 24, 2017, 6:14am UTC](https://discourse.julialang.org/t/interfacing-julia-red-error-with-julia-0-6-rc3/4180/12 "2017-07-24T06:14:10Z")

</div>

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