Dear Andreas Thanks a lot!
regards Moritz On Wednesday, 1 October 2014 16:12:36 UTC+2, Andreas Noack wrote: > > The error message gives a hint > > ERROR: type: fun: in ccall: first argument not a pointer or valid constant >> expression, expected DataType, got Type{(Any...,)} > > > The symbol name must be constant. Maybe you can get what you want by using > the @eval macro. Have a look in linalg/blas.jl or linalg/lapack.jl where > many fortran function are called. > > Med venlig hilsen > > Andreas Noack > > 2014-10-01 2:12 GMT-04:00 moritz braun <moritz...@gmail.com <javascript:>> > : > >> 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 >> >> >