I've been tracking Julia for a while however V1.0 of Julia was released recently so I thought I would evaluate some of its cool features for DSP prototyping.
Integrating SigLib with Julia was unbelievably easy using the ccall API. If only other languages contained a similarly simple API ;-)
To run SigLib (or any other shared library) from Julia is very easy using ccall.
For SigLib, copy the following code into a file "juliaSigLib.jl" :
A = [3.4, 1.8, -2.8, 6.4]
B = Array{Float64,1}(undef, length(A))
absMax = ccall((:SDA_AbsMax, "siglib"), Float64, (Ptr{Cdouble},Cint), A, length(A))
println("absMax: ", absMax)
ccall((:SDA_SortMinToMax, "siglib"), Cvoid, (Ptr{Cdouble},Ptr{Cdouble},Cint), A, B, length(A))
println("B: ", B)
Now copy the appropriate shared library to the current working directory where you will run juliaSigLib.jl.
OS | Source File | Destination File |
---|---|---|
32 Bit Linux | siglib/lib/linux/siglib.so.1.0 | siglib.so |
64 Bit Linux | siglib/lib/linux_64/siglib.so.1.0 | siglib.so |
Raspberry Pi Linux | siglib/lib/RaspberryPi/siglib.so.1.0 | siglib.so |
32 Bit Windows | siglib\lib\Microsoft\dynamic_library\Release\siglib.dll | siglib.dll |
64 Bit Windows | siglib\lib\Microsoft\dynamic_library_64\Release\siglib64.dll | siglib.dll |
To execute the script use :
julia juliaSigLib.jl
Awesome!
Reference : https://docs.julialang.org/en/v0.6.1/manual/calling-c-and-fortran-code/
To download the evaluation version of the Numerix-DSP Libraries : http://www.numerix-dsp.com/eval/.
Copyright © 2018 Delta Numerix
No comments:
Post a Comment