Thanks for the pointers on immutable types.

Is it possible to access structs inside structs this way? That a
struct inside a struct, not a pointer inside a struct. Is an immutable
type again a bits type? Or do I need to flatten the structs to make
this work?

-erik

On Sun, Nov 16, 2014 at 11:16 AM, Isaiah Norton <[email protected]> wrote:
>> 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/
>
>



-- 
Erik Schnetter <[email protected]>
http://www.perimeterinstitute.ca/personal/eschnetter/

Reply via email to