I once wrote a simple example of how to write and compile C code as a shared library and call from Julia using ccall. I could share it if you are interested, although it has no documentation at all at the moment besides a couple of comments.
Main things you have to know from C are types, structs, arrays and pointers, passing arguments to functions by value and by reference, and the basics of memory allocation (this is almost the whole language, excluding standard libraries and quirkier parts of C99). Regarding the shared library part, you could probably live only knowing it is a way of exporting symbols from a binary file (.so on Linux, .dll on Windows, .dylib on OS X) in a way other programs can use them. I may have simplified or overcomplicated things, but I think these are the basic concepts one would need to write code that uses a shared library. -- João Felipe Santos On Fri, Aug 15, 2014 at 1:15 PM, Randy Zwitch <[email protected]> wrote: > I know the standard recommendation of K&R for people who want to learn C. > But what would people's recommendations be to learn *just enough* C to be > comfortable using C libraries from within Julia? For example, the manual > states: > > "The code to be called must be available as a shared library. Most C and > Fortran libraries ship compiled as shared libraries already... " > > Having done almost nothing in C, this statement doesn't help me a whole > lot, since I don't know what a shared library is. For instance, I've come > across a few .h files as open-source projects, but I think the above > statement is referring to .so files? > > So any recommendations how can I get enough knowledge about C to use ccall > if I desire, without taking a ton of time away from Julia? I also know > Python and R as a frame of reference. >
