> > so any suggestions for a library with a similar API would be much > appreciated.
I usually point people to Nettle.jl which is very small but exemplifies a few advanced ccall tricks. On Thu, Apr 16, 2015 at 9:53 AM, Isaiah Norton <[email protected]> wrote: > (I've made some wrappers previously using an old build, although I can't >> get Clang.jl working at the moment) > > > I know there is a bug on OS X, I'll try to get it fixed this week. If > there is some other problem, please let me know. > > On Thu, Apr 16, 2015 at 9:48 AM, Isaiah Norton <[email protected]> > wrote: > >> The API looks quite small, so I would suggest to just type it out -- from >> a quick look, everything should be wrappable in pure Julia. e.g. the >> equivalent to the first part of hello.cpp you linked would be: >> >> julia> immutable BeagleInstanceDetails >> resourceNumber::Int >> resourceName::Ptr{Cchar} >> implName::Ptr{Cchar} >> implDescription::Ptr{Cchar} >> flags::Clong >> end >> >> julia> retInfo = [BeagleInstanceDetails(0,0,0,0,0)] >> 1-element Array{BeagleInstanceDetails,1}: >> BeagleInstanceDetails(0,Ptr{Int8} @0x0000000000000000,Ptr{Int8} >> @0x000000000000 >> 0000,Ptr{Int8} @0x0000000000000000,0) >> >> julia> nPatterns=2 >> 2 >> >> julia> ccall((:beagleCreateInstance, "hmsbeagle64"), Int, >> (Cint,Cint,Cint,Cint,Cint,Cint,Cint,Cint,Cint,Ptr{Int}, >> Cint,Clong,Clong,Ptr{BeagleInstanceDetails}), >> 3,2,3,4,nPatterns,1,4,1,0,C_NULL,0,0,0,retInfo) >> 0 >> >> julia> retInfo >> 1-element Array{BeagleInstanceDetails,1}: >> BeagleInstanceDetails(0,Ptr{Int8} @0x0000000002a2d54c,Ptr{Int8} >> @0x0000000002a2 >> f040,Ptr{Int8} @0x00000000003e3390,135320150) >> >> On Thu, Apr 16, 2015 at 9:12 AM, Simon Frost <[email protected]> wrote: >> >>> Dear All, >>> >>> I'm trying to wrap the BEAGLE library for use in Julia: >>> >>> https://github.com/beagle-dev/beagle-lib >>> >>> I've used SWIG in the past, which works fine for Python: >>> >>> https://github.com/beagle-dev/beagle-lib/tree/master/examples/swig_python >>> >>> and I'm currently hacking my way through R: >>> >>> https://github.com/sdwfrost/beagle-lib/tree/master/examples/swig_r >>> >>> The API isn't big at all, but does require me to initialise some >>> pointers to structs, which are filled in by reference. A toy example in C >>> is here: >>> >>> >>> https://github.com/sdwfrost/beagle-lib/blob/master/examples/standalone/hellobeagle/src/hello.cpp >>> >>> I've looked through the docs in Julia, as well as Clang.jl (I've made >>> some wrappers previously using an old build, although I can't get Clang.jl >>> working at the moment), and StrPack.jl, and I was wondering whether anyone >>> had any pointers (no pun intended) to the current best practice for >>> wrapping a library like this? I work best from examples, so any suggestions >>> for a library with a similar API would be much appreciated. >>> >>> Best >>> Simon >>> >> >> >
