Unfortunately, Julia cannot be compiled to a library. At least not that I 
am aware of. What could be done is linking/loading the Julia runtime 
libraries. That is what the author of the linked article tried. Here he hit 
some road blocks due to how Julia and Go manipulate the stack - if I 
understood correctly. Since, the article is a few years old it might be 
something to try again.
IPC is actually my fallback scenario. It would like to avoid it for 
performance (serialize/deserialize) reasons.Might be the easiest/fastest 
way to get things started though.

On Friday, August 18, 2017 at 9:28:14 AM UTC+2, Konstantin Khomoutov wrote:
 

> I'm not familiar with Julia, but I'd offer two possible points to 
> consider: 
>
> * If Julia code can be compiled to a library exposing C interface 
>   (as Go makes possible on some platforms with the compiler's option 
>   -buildmode=c-archive), you can do just that and the call it from Go 
>   via the standard Go's cgo facility. 
>
> * You may consider an often overlooked approach to just not embed 
>   anything to anything else and instead employ IPC (inter-process 
>   communication). 
>
>   Say, you could possibly compile your Julia program 
>   so that it reads data in certain agreed-upon format on its stdin 
>   and writes the results of processing them to its stdout. 
>
>   Your Go server then merely starts your Julia program and wires two 
>   pipes to those standard I/O streams of the process it created. 
>   Communication then becomes a matter of writing stuff to one of those 
>   pipes and then reading the result from another one. 
>
>   If your Julia server need to be multithreaded, it's possible to 
>   use "job identifiers" with each task submitted to that Julia process; 
>   this would allow the latter to perform the jobs in parallel and 
>   use those job IDs in its answers which then could come out the result 
>   pipe in any order. 
>
> Certainly the latter approach is slower than the first but it's 
> definitely easier to implement and to reason about, and it fully 
> decouples both programs. 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to