`const` declarations in a function are essentially just ignored by the compiler. you need a module-level constant for this to work.
On Wed, Apr 29, 2015 at 1:54 PM Paul Thompson <[email protected]> wrote: > Hi, > > I am on Julia 0.3.2 on Debian and have been able to successfully work with > some library functions using ccall like this: > > const mylib="/home/paul/toolbox/DataAcq/libokFrontPanel.so" > x=ccall((:okFrontPanel, mylib), Ptr{Void}, ()) > > as well as with other functions in the library. I am now moving some of > these calls into a module, but now I get an error. For instance, if I call > the function open_board() in the following module: > > module rhd2000evalboard > > export open_board > > function open_board() > > const mylib="/home/paul/toolbox/DataAcq/libokFrontPanel.so" > x=ccall((:okFrontPanel, mylib), Ptr{Void}, ()) > > end > > end > > I get the error: > > ERROR: type: open_board: in ccall: first argument not a pointer or valid > constant expression, expected DataType, got Type{(Any...,)} > > I'm not sure why the input tuple is no longer constant. I have tried to > use the constant tuple as an input to the function as well with no success. > Any one have any ideas? > > Thanks! > > > Paul > > >
