# How do you write 'binding/wrapper' for some python/c++ package

**URL:** <https://discourse.julialang.org/t/how-do-you-write-binding-wrapper-for-some-python-c-package/27027>\
**Category:** General Usage\
**Tags:** question\
**Created:** [July 31, 2019, 10:37am UTC](https://discourse.julialang.org/t/how-do-you-write-binding-wrapper-for-some-python-c-package/27027 "2019-07-31T10:37:41Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [October 8, 2025, 9:50am UTC](https://discourse.julialang.org/t/how-do-you-write-binding-wrapper-for-some-python-c-package/27027/2 "2025-10-08T09:50:37Z")

</div>

> [@jling](#):
>
> Is there s a systematic way of writing a binding package in Julia or it’s really ‘manual’ to a large extend?

For binders (i.e. wrappers) you use or should be using PythonCall.jl (main option now). A lot of Python package also have C or C++ code, but usually still only Python API, so you only need to call it, and indirectly the other implementation languages, so you likely never need to think of calling C or C++, bypassing Python API. I believe PythonCall.jl is the most systematic “automated” there is if you mean that, and you do not have to make a binding package, but you can, mainly to help others, and then you would still use it.

What you do depends on the language, i.e. what language you want to bind to most directly, e.g. for C++ CxxWrap.jl is recommended (there are more packages like [GitHub - timholy/Cpp.jl: Utilities for calling C++ from Julia](https://github.com/timholy/Cpp.jl) I believe all or most outdated/redundant), if there’s no C API already, but very commonly such exists for C++ code, at least if meant to be wrapped, but if a C API is available, the C++ code just functions like calling any other C code, and you just use `ccall` keyword, to call a dynamic link library.

Note FFTW.jl depends on FFTW\_jll (for the compiled C code, all you need to call for it, despite implemented by OCaml too; and see also GR\_jll, also implemented in C), for binary, code, it’s common to have a jll, for the compiled C code or whatever other compiled language.

For Scala you use JavaCall.jl, and well for Java to and some more lagnuages, likely e.g. for Kotlin, should be possible.

To call _from_ C you embed Julia in it, and call from C (indirectly this is done for you with the packages like JuliaCall, for Python or e.g. R; and sometimes you embed yourself too this way for e.g. C++, Fortran or Rust):

> [@How to make Julia call C/C++ coded function](https://discourse.julialang.org/t/how-to-make-julia-call-c-c-coded-function/54780):
>
> Hi all, I am a complete beginner in Julia. My question is: how to make a julia script call C or C++ coded function. If it’s possible, can this enhance the performance in term of speed of execution (if we compare it with a fully julia coded script)? I am using Debian GNU/Linux. Best !

For Rust though you likely use:  
[https://crates.io/crates/jlrs/](https://crates.io/crates/jlrs/)

You can use `node-julia`, and something for Ruby, Lua, C# etc. to call to or from.

You could call C code from the start with `ccall` (or use it to call Fortran and more even Rust), but not there’s also:

> [@CBinding.jl - bringing C's nested structs/unions, alignment, bitfields, variadic functions to Julia](https://discourse.julialang.org/t/cbinding-jl-bringing-cs-nested-structs-unions-alignment-bitfields-variadic-functions-to-julia/25902):
>
> I am announcing the availability of package [CBinding.jl](https://github.com/analytech-solutions/CBinding.jl) as a much improved way of interfacing C APIs from Julia with syntax analogous to the C you are binding to! julia\> using CBinding julia\> @cstruct MyCStruct { # struct MyCStruct { c::Cchar # char c; i::Cint # int i; @cunion { # union { f::Cfloat # float f; d::Cdouble # double d; } …

And to help call C [API], e.g. also for C++ code, you can use Clang.jl:

> [@Best way to create a julia function wrapper of a cpp function](https://discourse.julialang.org/t/best-way-to-create-a-julia-function-wrapper-of-a-cpp-function/25915/3):
>
> It depends on your specific use case. If you’re wrapping a small cpp library which only exports a few APIs or a large one in which you only need to call a small subset API, then the “best way” would be to manually 1. write a C89 wrapper over the library and 2. embed it in Julia by directly using ccall. No package, no magic, and no performance overhead. However, if you’re gonna wrap everything in a large cpp library, it is just not feasible to manually do the above two steps. Currently, there a…

---

_[View the full topic](https://discourse.julialang.org/t/how-do-you-write-binding-wrapper-for-some-python-c-package/27027)._
