On Tuesday, September 6, 2016 at 10:41:17 AM UTC-4, simon rss wrote: > > Hello, Bart Janssens. I have a question. > > If eventually all things compile down to machine code, why those callings > will have overhead? Why can't the compiler glue C part and julia part > seamlessly at machine code level? > >> Calling C or C++ from Julia can have little or no overhead, because Julia's compiler knows about C. The reverse is not necessarily true, because the C compiler doesn't know about Julia. (However, if you compile a static C-callable interface to a Julia function with cfunction, then there is no more overhead to call this from C than any other C function pointer.)
(Caveat: cross-language inlining is not generally possible, nor can functions called from shared libraries or function pointers be inlined, so if you have very small functions it is more efficient to call them as Julia code within Julia code because then they can be inlined.)
