# Jl\_eval\_string vs jl\_load\_file\_string

**URL:** <https://discourse.julialang.org/t/jl-eval-string-vs-jl-load-file-string/5591>\
**Category:** General Usage\
**Tags:** embedding\
**Created:** [August 27, 2017, 2:10pm UTC](https://discourse.julialang.org/t/jl-eval-string-vs-jl-load-file-string/5591 "2017-08-27T14:10:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bdurin](https://avatars.discourse-cdn.com/v4/letter/b/fbc32d/32.png) [@bdurin](https://discourse.julialang.org/u/bdurin)\
**Post date:** [August 27, 2017, 2:10pm UTC](https://discourse.julialang.org/t/jl-eval-string-vs-jl-load-file-string/5591/1 "2017-08-27T14:10:19Z")

</div>

Hi,

What is the difference between the two functions? (For jl\_load\_file\_string I am considering only the case when a string is passed, not a filename.)  
As far as I could understand from the source code, jl\_eval\_string parse its input with jl-parse-string on the femtolisp side, and jl\_load\_file\_string (jl\_parse\_eval\_all in fact) uses jl-string-stream. I am not able to understand lisp source code, but from the name I would say there is no real difference. As regards evaluation of the code, both functions eventually call jl\_interpret\_toplevel\_expr\_in which in turns call eval (the C function defined in interpret.c, not the Julia one). I am not able to understand the impact of the differences in the code which is run before and after the call to eval.

Thanks,  
Bruno

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [August 29, 2017, 7:30pm UTC](https://discourse.julialang.org/t/jl-eval-string-vs-jl-load-file-string/5591/2 "2017-08-29T19:30:32Z")

</div>

My understanding is that `jl_eval_string` is equivalent to `eval(parse(s))` in Julia, and only evaluates a string containing a single expression. `jl_load_file_string` is equivalent to `include_string` in Julia, and can evaluate multiple expressions (on separate lines).

---

<div class="post-metadata">

**Author:** ![bdurin](https://avatars.discourse-cdn.com/v4/letter/b/fbc32d/32.png) [@bdurin](https://discourse.julialang.org/u/bdurin)\
**Post date:** [August 29, 2017, 8:12pm UTC](https://discourse.julialang.org/t/jl-eval-string-vs-jl-load-file-string/5591/3 "2017-08-29T20:12:58Z")

</div>

That is what I thought at first but I tried sending a multiline string (so with several expressions) to jl\_eval\_string and it worked. I asked the question because the 2 functions seem to do the same thing.
