On Sat, Aug 8, 2015 at 2:50 AM, Traktor Toni <[email protected]> wrote:
> workspace()
> immutable TestStruct
> a::UInt32
> end
> t2 = ccall((:inet_addr, "libc", TestStruct, (Ptr{UInt8},), "localhost"))
The error is "ERROR: unsupported or misplaced expression **ccall**".
i.e. not "**call**".
The issue is you put the parenthesis at the wrong place. You should do
julia> t2 = ccall((:inet_addr, "libc"), TestStruct, (Ptr{UInt8},), "localhost")
TestStruct(0xffffffff)
I'm not sure how we could give a better error message in this case.
This doesn't seem like the most likely misuse pattern and I don't
think we necessarily want to get into the business of guessing what
you want to do with random pattern matching. (We could certainly add
this if more people find this is a easy mistake to have)
>
> Why doesnt this work? And the error is really poor, how am I supposed to
> know which parameters are wrong by reading "unsupported or misplaced
> expression call"?
> I also tried a simpler example with just UInt32 as return value but that
> doesnt work either.