Ccall of a thread C function from REPL


I’ve made a standalone GUI application in C++ and I can call it from Julia REPL. To achieve this, I exported a C function named int entry_point() calling the GUI which loops for ever until the user close the window. I compiled this function as a shared library.

julia> ccall((:entry_point, "/usr/lib/"), Int, ())

This is working well, but I have no longer access to the REPL and I want to extend the API of my GUI application to allow me to return some result that I can exploit from the REPL, something like this:

julia> handle = ccall(...)

... the gui is working ...

julia> foo = my_function(handle)

... the gui is working ...

For the moment, I do not know how to thread my entry_point function. If I call std::thread without calling join() the REPL will crash. Is there a good way to tell Julia to thread my ccall and let me access to the REPL ?