> > The library defines some C structs that are part of the API. My > current approach uses wrapper C functions to access struct elements. > Is there a better way?
It depends how complicated are the structs. Structs can often be reflected as Julia types, as long as isbits(TypeName) == true, and accessed with unsafe_load (see for example PyCall's definitions of PyObject_*). Some tricky spots include fixed-size arrays and unions (strictly speaking you can make an aggregate element having the maximal size in the union, and then do bitshifts manually. but there is no automatic support). There is also the StrPack.jl package, which calculates the appropriate memory layout for a given struct and provides serialization/deserialization. I thus I need to build this wrapper file as well. I created a > SimpleBuild rule for this. However, I need to know the path where > BinDeps installed (or found) the header files so that I can compile > this file. How do I access this information? This is going to be package-manager and build-tool specific, and I don't know if there is any abstraction/helper for includes in BinDeps yet. On Sun, Nov 16, 2014 at 10:09 AM, Erik Schnetter <[email protected]> wrote: > I want to wrap a library (hwloc) for Julia. This is working fine. > > The library defines some C structs that are part of the API. My > current approach uses wrapper C functions to access struct elements. > Is there a better way? > > I thus I need to build this wrapper file as well. I created a > SimpleBuild rule for this. However, I need to know the path where > BinDeps installed (or found) the header files so that I can compile > this file. How do I access this information? > > -erik > > -- > Erik Schnetter <[email protected]> > http://www.perimeterinstitute.ca/personal/eschnetter/ >
