Skip to content

scoping/escaping bug in @cfunction #565

@stevengj

Description

@stevengj

The Compat.@cfunction macro (#553) seems to have an escaping or scoping bug of some kind that prevents it from being used in a function. For example:

julia> using Compat

julia> foo(x) = x+1
foo (generic function with 1 method)

julia> bar() = @cfunction(foo, Int, (Int,))
bar (generic function with 1 method)

julia> bar()
ERROR: UndefVarError: foo not defined
Stacktrace:
 [1] bar() at ./REPL[3]:1

julia> baz() = cfunction(foo, Int, Tuple{Int})
baz (generic function with 1 method)

julia> baz()
Ptr{Void} @0x0000000121a79f50

cc @ararslan .

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions