Dear Friends

I want to wrap a fortran code that provides the Lebedev-Laikov quadrature 
points and weights for
32  different orders for 6 to 5810!

I have tried it with the following code
for a file LebedevLaikov.jl
===================
module LebedevLaikov
export ldfuns
ldnames={:ld0006_, :ld0014_, :ld0026_, :ld0038_, :ld0050_, :ld0074_, 
:ld0086_, :ld0110_, :ld0146_, :ld0170_, :ld0194_, :ld0230_, :ld0266_, 
:ld0302_, :ld0350_, :ld0434_, :ld0590_, :ld0770_, :ld0974_, :ld1202_, 
:ld1454_, :ld1730_, :ld2030_, :ld2354_, :ld2702_, :ld3074_, :ld3470_, 
:ld3890_, :ld4334_, :ld4802_, :ld5294_, :ld5810_}
ldns=[6,14,26,38,50,74,86,110,146,170,194,230,266,302,350,434,590,770,974,1202,1454,1730,2030,2354,2702,3074,3470,3890,4334,4802,5294,5810]
println( length(ldns)," ",length(ldnames))
nl=length(ldnames)
# factory function for creating a function for each case!
function ldfact()
    funs=Dict()
    for i in [1:nl]
        name=ldnames[i]
        ldn=ldns[i]
        function fun()
            X,Y,Z,W=zeros(ldn),zeros(ldn),zeros(ldn),zeros(ldn)
            N=0
            ccall( 
(name,"Lebedev-Laikov.so"),Void,(Ptr{Float64},Ptr{Float64},Ptr{Float64},Ptr{Float64},Ptr{Int32}),X,Y,Z,W,&N)
 
           
            return X,Y,Z,W,N
        end
        funs[ldn]=fun    
    end
    return funs
end
ldfuns=ldfact()
end
==
in the interactive julia session
using LebedevLaikov 
works
however
ldfuins[110]()
results in the error message
ERROR: type: fun: in ccall: first argument not a pointer or valid constant 
expression, expected DataType, got Type{(Any...,)}
 in fun at /home/braunm/bfuns/julia/LebedevLaikov.jl:16

I am somehow stack with supplying the symbol of the function via a variable 
instead of 
in place
Any help will be very much appreciated!

Thanks a lot to all the magicians that have made  julia already so amazing!

regards

Moritz 

Reply via email to