# Is it possible to create a closed source library package?

**URL:** <https://discourse.julialang.org/t/is-it-possible-to-create-a-closed-source-library-package/129453>\
**Category:** General Usage\
**Created:** [May 30, 2025, 12:22am UTC](https://discourse.julialang.org/t/is-it-possible-to-create-a-closed-source-library-package/129453 "2025-05-30T00:22:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![victor\_vhrn](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/victor_vhrn/32/214016_2.png) [@victor\_vhrn](https://discourse.julialang.org/u/victor_vhrn)\
**Post date:** [May 30, 2025, 12:22am UTC](https://discourse.julialang.org/t/is-it-possible-to-create-a-closed-source-library-package/129453/1 "2025-05-30T00:22:42Z")

</div>

Is it possible to release a package without easily exposing the source code? In my use case, my package is a library where the user must provide callback functions as input. Most of the ideas I found seem to apply only to applications, as in [How to build closed-source julia package?](https://discourse.julialang.org/t/how-to-build-closed-source-julia-package/76985)

From the PackageCompiler.jl docs, it seems that I could compile the code to a C library and create a wrapper that calls the C library from Julia, but it doesn’t seem feasible to pass functions to the C library.

Is it possible to do what I’m trying? Am I having any misconception?

---

<div class="post-metadata">

**Author:** ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)\
**Post date:** [May 30, 2025, 1:31am UTC](https://discourse.julialang.org/t/is-it-possible-to-create-a-closed-source-library-package/129453/2 "2025-05-30T01:31:48Z")

</div>

> [@victor\_vhrn](#):
>
> it doesn’t seem feasible to pass functions to the C library

Passing Julia function pointers as an input for C functions is technically possible with some limitations, but that’s for [Julia embedded in C](https://docs.julialang.org/en/v1/manual/embedding/#Calling-Julia-Functions) or [`ccall`-ing a C function](https://docs.julialang.org/en/v1/manual/calling-c-and-fortran-code/#Creating-C-Compatible-Julia-Function-Pointers). No idea if that can work for a `@ccallable` function as smoothly as a normal higher-order Julia function, and the `@cfunction` macro would likely constrain how users handle their callback functions.

---

<div class="post-metadata">

**Author:** ![MDSW](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@MDSW](https://discourse.julialang.org/u/MDSW)\
**Post date:** [May 31, 2025, 1:20am UTC](https://discourse.julialang.org/t/is-it-possible-to-create-a-closed-source-library-package/129453/3 "2025-05-31T01:20:32Z")

</div>

There’s a good discussion and examples [here](https://github.com/GunnarFarneback/DynamicallyLoadedEmbedding.jl/tree/master) (for dynamic libraries) that I recently used. The basic approach is to create the Julia function, then generate a pointer to it with `@cfunction`, then get a the global for the symbol you’ve assigned the result to, and that is the pointer to the function in a C callable form.
