Embedding and include

What is the story with include in embedded Julia on 0.7+? If, for example, you add


in the embedding example (test/embedding/embedding.c), the result is

UndefVarError: include not defined

To be able to include something you need to do Base.include(Main, filename) instead or start out with an eval of include(x) = Base.include(Main, x). Is this a feature or a bug? If it’s intentional I think it needs some kind of mention in the documentation.


I also would love an explanation for this. I’ve just spent all morning banging my head against working out that a failure to include some code was causing all my errors. Your work around has at least got me progressing further.

As an aside I’d love to see your definition of checked_eval_string - I’ve got a really rough one myself that could do with a clean up.

I was referring to checked_eval_string in the embedding example in Julia’s source code: https://github.com/JuliaLang/julia/blob/master/test/embedding/embedding.c#L17-L31

Depending on how you do your embedding you might find things of interest in some of these issues and a PR:

Those are great references, and should help,