I do not think you can use that C code (as is) from Julia. All the 
functions are declared "static inline", and thus they need to be compiled 
together with the code that calls them.

I do not have a deep knowledge of C, linking, and shared libraries, but I 
will attempt to give an outline on what steps you will need to google for.

   1. Make the functions externally callable. This means that you will at 
   least remove `static`, but likely you want to remove `inline also`. Just 
   search for `static inline ` and replace by empty string
   2. Compile the c code and link it into the julia process. If you are on 
   windows you might need to specially mark the symbols as exported. If you 
   compile julia yourself, and do not plan to distribute the code, you might 
   have success with just #include <fastonebigheader.h>, but ideally you 
   should compile it as a shared library.
   3. Use the functions with `ccall` as normal. If you include the header 
   in a julia, you will not need to specify a library.

You ask a fairly open question that could actually be the basis of a book. 
It would be easier to answer more specifically if you included a paragraph 
about your project and why you want to use this code. If it is not just 
curiosity about whether it is possible, you might instead get a better 
suggestion for how to solve your problem.

Ivar

kl. 19:22:56 UTC+1 onsdag 19. februar 2014 skrev Bob Quazar følgende:
>
> I'm trying to call C code from Julia. The C code is just a big header 
> file: 
> http://fastapprox.googlecode.com/svn/trunk/fastapprox/src/fastonebigheader.h
> (There's no  corresponding .c file.) I've installed this header file in my 
> "/usr/include/" directory, but according to the Julia web site, Julia only 
> accesses C shared objects. I'm not sure what to do---wish I understood 
> C/gcc better. I'd greatly appreciate any help.
>
> Thanks, Bob
>

Reply via email to