# JuliaC feature request: strip off libuv when there's no IO

**URL:** <https://discourse.julialang.org/t/juliac-feature-request-strip-off-libuv-when-theres-no-io/134043>\
**Category:** Internals & Design\
**Tags:** io, juliac\
**Created:** [November 22, 2025, 11:28am UTC](https://discourse.julialang.org/t/juliac-feature-request-strip-off-libuv-when-theres-no-io/134043 "2025-11-22T11:28:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![greatpet](https://avatars.discourse-cdn.com/v4/letter/g/e495f1/32.png) [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Post date:** [November 22, 2025, 11:28am UTC](https://discourse.julialang.org/t/juliac-feature-request-strip-off-libuv-when-theres-no-io/134043/1 "2025-11-22T11:28:41Z")

</div>

Using a shared libraries compiled by [JuliaC](https://github.com/JuliaLang/JuliaC.jl) seems to cause unexpected interactions with the IO of a host program, even when the shared library is purely numerical and does not perform IO. I think this is caused by Juila’s libuv for async IO. Here’s a short MWE, adapted from the official JuliaC examples. First, the Julia code to be compiled:

```julia
# libtest.jl
module LibTest

Base.@ccallable function jc_add_one(x::Cint)::Cint
    return x + 1
end

end # module

```

I compile it with

```shell
juliac --output-lib libjc_add_one.so --bundle jc_add_one --trim=safe --experimental --compile-ccallable libtest.jl

```

Next, I call the shared library from the following C program, which repeatedly reads stdin for integers and prints out the results after adding 1:

```cpp
// ctest.c
#include <stdio.h>

int jc_add_one(int x); // to link against libjc_add_one.so

int main(void) {
    int i;
    while (!feof(stdin)) {
        if (scanf("%d", &i) == 1) {
            printf("%d\n", jc_add_one(i));
            fflush(stdout);
        }
        else {
            if (!feof(stdin))
                printf("invalid integer input!\n");
        }
    }
    return 0;
}

```

I compile it with

```shell
gcc ctest.c -o ctest -Ljc_add_one/lib -ljc_add_one -Wl,-rpath,jc_add_one/lib

```

I test it in the shell with a pipeline in Linux:

```bash
{ echo 1; sleep 1; echo 2; } | ./ctest

```

The output is

```julia-auto
2
invalid integer input!
invalid integer input!
invalid integer input!
invalid integer input!
invalid integer input!
[5 million lines omitted]

```

The expected out is, e.g. as generated by a C program using `i+1` instead of `jc_add_one(i)`,

```julia-auto
2
3

```

I’ve previously posted about issues with embedding Juila in C (on [Discourse](https://discourse.julialang.org/t/c-program-embedding-julia-works-in-terminal-but-breaks-in-pipes/86973) and [Github](https://github.com/JuliaLang/julia/issues/60003)), but I just noticed that the same libuv issue is also present with JuliaC. Would it be possible for future versions of JuliaC to strip off libuv when the compiled program / library does not perform IO? I’d like to “sneak” some Julia code into existing C/C++/Python projects for CLI tools with heavy use of pipes, without requiring my collaborators to adapt the IO aspects of the rest of the codebase.

I have Julia 1.12.1 x86\_64-linux-gnu, GCC 15.2.1, and JuliaC installed from `Pkg` a few days ago (not sure how to print out its version).

P.S. the JuliaC version is v0.2.2.

---

<div class="post-metadata">

**Author:** ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)\
**Post date:** [November 22, 2025, 11:40am UTC](https://discourse.julialang.org/t/juliac-feature-request-strip-off-libuv-when-theres-no-io/134043/2 "2025-11-22T11:40:09Z")

</div>

This is probably not as simple as it may seem. Even when there is no IO in the form of printing going on, the async runtime of libuv is still used for task scheduling. As there is always at least one task, removing libuv is currently not possible.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [November 22, 2025, 12:34pm UTC](https://discourse.julialang.org/t/juliac-feature-request-strip-off-libuv-when-theres-no-io/134043/3 "2025-11-22T12:34:01Z")

</div>

> [@greatpet](#):
>
> (not sure how to print out its version).

Type:

```julia-auto
versioninfo()

```

at the Julia prompt (REPL).

---

<div class="post-metadata">

**Author:** ![greatpet](https://avatars.discourse-cdn.com/v4/letter/g/e495f1/32.png) [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Post date:** [November 22, 2025, 12:37pm UTC](https://discourse.julialang.org/t/juliac-feature-request-strip-off-libuv-when-theres-no-io/134043/4 "2025-11-22T12:37:34Z")

</div>

I meant the version of JuliaC installed from `pkg> app add JuliaC`. This doesn’t show up in the output of `pkg> st`.

---

<div class="post-metadata">

**Author:** ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)\
**Post date:** [November 22, 2025, 12:43pm UTC](https://discourse.julialang.org/t/juliac-feature-request-strip-off-libuv-when-theres-no-io/134043/5 "2025-11-22T12:43:16Z")

</div>

You can do `app st`:

```julia
(@v1.12) pkg> app st
[7d51a73a] ExplicitImports v1.13.0
  explicit-imports-jl ~/.julia/juliaup/julia-1.12.0-rc1+0.aarch64.apple.darwin14/bin/julia
[78c8a9bf] SearchablePDFs v0.1.0 `https://github.com/ericphanson/SearchablePDFs.jl#main`
  searchable-pdf ~/.julia/juliaup/julia-1.12.1+0.aarch64.apple.darwin14/bin/julia
[acedd4c2] JuliaC v0.2.2
  juliac ~/.julia/juliaup/julia-1.12.1+0.aarch64.apple.darwin14/bin/julia

```
