Compile (and call) a C function from Julia


#1

I wonder if it would make sense that Julia enables one to call a C function described by its source code…
ccall("
#include <stdio.h>
int main()
{
// printf() displays the string inside quotation
printf(“Hello, World!”);
return 0;
}")


#2

Cxx.jl has that function.


#3

Thank you !!


#4

Note that if you have a C compiler installed, you can invoke it an load the resulting code pretty easily from Julia. See e.g. the first example in:


#5

Thank you very much for the link ! The conciseness of the C function build looks like blackmagic :open_mouth: I should add this one to Sum performance for Array{Float64,2} elements benchmark curves (I think I remember that gcc did not perform very well on that specific loop).