# \#c

**URL:** https://discourse.julialang.org/tag/c/610.md?match_all_tags=true&page=3&tags%5B%5D=c

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

**Page:** 4

---

## [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)

<div class="topic-metadata">

**Author:** [@krrutkow](https://discourse.julialang.org/u/krrutkow)\
**Replies:** 12\
**Last updated:** [October 9, 2021, 3:38am UTC](https://discourse.julialang.org/t/cbinding-jl-bringing-cs-nested-structs-unions-alignment-bitfields-variadic-functions-to-julia/25902 "2021-10-09T03:38:41Z")

</div>

I am announcing the availability of package 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 { # s…

---

## [Wrapping Templated C++-functions and embedding Julia-functions subject to templates](https://discourse.julialang.org/t/wrapping-templated-c-functions-and-embedding-julia-functions-subject-to-templates/69282)

<div class="topic-metadata">

**Author:** [@Jonas\_Hjulstad](https://discourse.julialang.org/u/Jonas_Hjulstad)\
**Replies:** 0\
**Last updated:** [October 6, 2021, 7:48am UTC](https://discourse.julialang.org/t/wrapping-templated-c-functions-and-embedding-julia-functions-subject-to-templates/69282 "2021-10-06T07:48:56Z")

</div>

I’m looking into the idea of treating instructions as data for an C++ Eigen-algorithm. I already assume that the g+±compiler will be able to resolve the wrapping to Julia using Cxxwrap: GitHub - JuliaInterop/CxxWrap.jl…

---

## [Running a CMakeLists.txt programmatically](https://discourse.julialang.org/t/running-a-cmakelists-txt-programmatically/69238)

<div class="topic-metadata">

**Author:** [@MitchellWeg](https://discourse.julialang.org/u/MitchellWeg)\
**Replies:** 1\
**Last updated:** [October 5, 2021, 3:44pm UTC](https://discourse.julialang.org/t/running-a-cmakelists-txt-programmatically/69238 "2021-10-05T15:44:58Z")

</div>

Hi Julia community, I have a C library that needs to be built with a CMakeLists, but I haven’t figured out how to do that programmatically. I know that packages like CMakeWrapper and BinDeps. Yet I find the documentati…

---

## [How to ccall struct array from C?](https://discourse.julialang.org/t/how-to-ccall-struct-array-from-c/68805)

<div class="topic-metadata">

**Author:** [@kimmolinna](https://discourse.julialang.org/u/kimmolinna)\
**Replies:** 4\
**Last updated:** [September 28, 2021, 3:43am UTC](https://discourse.julialang.org/t/how-to-ccall-struct-array-from-c/68805 "2021-09-28T03:43:11Z")

</div>

I would like read call directly duckdb c-api, but I have some difficulties with structs. I try to do the following c-code in Julia. #include "duckdb.h" #include \<stdio.h\> int main() { duckdb\_database db = NULL; duckd…

---

## [Question on Calling Julia functions from C++ with CxxWrap (and Eventually Interfacing with Julia from MATLAB)](https://discourse.julialang.org/t/question-on-calling-julia-functions-from-c-with-cxxwrap-and-eventually-interfacing-with-julia-from-matlab/68378)

<div class="topic-metadata">

**Author:** [@GrantHecht](https://discourse.julialang.org/u/GrantHecht)\
**Replies:** 2\
**Last updated:** [September 25, 2021, 8:08pm UTC](https://discourse.julialang.org/t/question-on-calling-julia-functions-from-c-with-cxxwrap-and-eventually-interfacing-with-julia-from-matlab/68378 "2021-09-25T20:08:28Z")

</div>

Hello everyone, I have a relatively unique use case for Julia and CxxWrap.jl. To provide some background, my current research involves employing heuristic optimization algorithms to assist in solving spacecraft trajecto…

---

## [Dealing with "C style" memory layout](https://discourse.julialang.org/t/dealing-with-c-style-memory-layout/68627)

<div class="topic-metadata">

**Author:** [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Replies:** 2\
**Last updated:** [September 23, 2021, 1:11pm UTC](https://discourse.julialang.org/t/dealing-with-c-style-memory-layout/68627 "2021-09-23T13:11:44Z")

</div>

In julia arrays are stored using the fortran memory ordering. When interacting with other languages that use “C” ordering it is often necessary to convert between the two. Usually I do this in an add hoc manner like pe…

---

## [Is there a way to use a debugger on scripts running embedded in C++? If so, how?](https://discourse.julialang.org/t/is-there-a-way-to-use-a-debugger-on-scripts-running-embedded-in-c-if-so-how/68031)

<div class="topic-metadata">

**Author:** [@solaris](https://discourse.julialang.org/u/solaris)\
**Replies:** 12\
**Last updated:** [September 23, 2021, 9:00am UTC](https://discourse.julialang.org/t/is-there-a-way-to-use-a-debugger-on-scripts-running-embedded-in-c-if-so-how/68031 "2021-09-23T09:00:08Z")

</div>

Ideally in an IDE like VSCode. If only command line is possible, that’s ok for now.

---

## [Interfacing with a C++ library: strange behaviour](https://discourse.julialang.org/t/interfacing-with-a-c-library-strange-behaviour/67999)

<div class="topic-metadata">

**Author:** [@circonflexe](https://discourse.julialang.org/u/circonflexe)\
**Replies:** 4\
**Last updated:** [September 15, 2021, 6:48pm UTC](https://discourse.julialang.org/t/interfacing-with-a-c-library-strange-behaviour/67999 "2021-09-15T18:48:21Z")

</div>

This is a long shot, but I have absolutely no idea what is happening here… So I try to write a wrapper for a few functions in the (C++, header-only) libigl geometry library. For this I write an intermediary C library wh…

---

## [Easy call to Julia functions from C++ using C++14](https://discourse.julialang.org/t/easy-call-to-julia-functions-from-c-using-c-14/20751)

<div class="topic-metadata">

**Author:** [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Replies:** 0\
**Last updated:** [February 13, 2019, 3:51pm UTC](https://discourse.julialang.org/t/easy-call-to-julia-functions-from-c-using-c-14/20751 "2019-02-13T15:51:13Z")

</div>

Hi guys! I just want to share a very simple code I created in C++ (using standard C++14) to make calls to Julia functions easier. My use case is that I need to call a lot of functions from my package SatelliteToolbox.jl …

---

## [Embedding Julia code in parallel C++](https://discourse.julialang.org/t/embedding-julia-code-in-parallel-c/68163)

<div class="topic-metadata">

**Author:** [@GlenHenshaw](https://discourse.julialang.org/u/GlenHenshaw)\
**Replies:** 2\
**Last updated:** [September 14, 2021, 10:53pm UTC](https://discourse.julialang.org/t/embedding-julia-code-in-parallel-c/68163 "2021-09-14T22:53:48Z")

</div>

Hey all- I’m working on a rather large machine learning project that entails using a C++ main to call functions written in Julia. In addition the regular pain of who manages what variables and how to translate between bi…

---

## [Calling Julia from C++ -- Compatibility with AddressSanitizer](https://discourse.julialang.org/t/calling-julia-from-c-compatibility-with-addresssanitizer/6517)

<div class="topic-metadata">

**Author:** [@jinliangwei](https://discourse.julialang.org/u/jinliangwei)\
**Replies:** 0\
**Last updated:** [October 18, 2017, 4:08am UTC](https://discourse.julialang.org/t/calling-julia-from-c-compatibility-with-addresssanitizer/6517 "2017-10-18T04:08:55Z")

</div>

I have a C++ program that calls Julia functions. In some cases, those Julia functions are dynamically generated and JIT-compiled. I tried to use AddressSanitizer (libasan) to check for memory errors in my program, but it…

---

## [Calling Julia Functions using 'cfunction'](https://discourse.julialang.org/t/calling-julia-functions-using-cfunction/9032)

<div class="topic-metadata">

**Author:** [@pemryan](https://discourse.julialang.org/u/pemryan)\
**Replies:** 0\
**Last updated:** [February 13, 2018, 12:06pm UTC](https://discourse.julialang.org/t/calling-julia-functions-using-cfunction/9032 "2018-02-13T12:06:16Z")

</div>

Hello, Besides the examples given in doc (https://docs.julialang.org/en/stable/manual/embedding/), I figured out two more methods to call Julia functions in C, using the built-in ‘cfunction’: 1) use julia cfunction …

---

## [Transfer a Sparse Matrix to a C Function](https://discourse.julialang.org/t/transfer-a-sparse-matrix-to-a-c-function/67883)

<div class="topic-metadata">

**Author:** [@RoyiAvital](https://discourse.julialang.org/u/RoyiAvital)\
**Replies:** 13\
**Last updated:** [September 11, 2021, 7:48pm UTC](https://discourse.julialang.org/t/transfer-a-sparse-matrix-to-a-c-function/67883 "2021-09-11T19:48:26Z")

</div>

I have a C function (See IncompleteCholeskyDecomposition.c) which accepts a Sparse Matrix in CSC format (Actually 2 matrices). I wonder, how do I extract the data, row index and column pointer from a given Julia Sparse …

---

## [How to indicate a specific path to julia libdl find\_library()?](https://discourse.julialang.org/t/how-to-indicate-a-specific-path-to-julia-libdl-find-library/67794)

<div class="topic-metadata">

**Author:** [@Julie96](https://discourse.julialang.org/u/Julie96)\
**Replies:** 6\
**Last updated:** [September 8, 2021, 9:20am UTC](https://discourse.julialang.org/t/how-to-indicate-a-specific-path-to-julia-libdl-find-library/67794 "2021-09-08T09:20:24Z")

</div>

copy paste of this thread : I’m trying to indicate a specific path to find\_library(). Based on the doc, find\_library() Searches for the first library in names in the paths in the locations list, DL\_LOAD\_PATH, or syste…

---

## [How to call a custom julia function from c++ (a custom locally created .jl file)](https://discourse.julialang.org/t/how-to-call-a-custom-julia-function-from-c-a-custom-locally-created-jl-file/67708)

<div class="topic-metadata">

**Author:** [@solaris](https://discourse.julialang.org/u/solaris)\
**Replies:** 18\
**Last updated:** [September 6, 2021, 12:35pm UTC](https://discourse.julialang.org/t/how-to-call-a-custom-julia-function-from-c-a-custom-locally-created-jl-file/67708 "2021-09-06T12:35:20Z")

</div>

So I wrote a julia file myself, called function.jl, and I want to load it in C++ and call functions in it. That’s it. I can’t find anything in the documentation about this. The docs cover jl\_eval\_string and jl\_get\_fun…

---

## [Julia vs C++ speed](https://discourse.julialang.org/t/julia-vs-c-speed/67219)

<div class="topic-metadata">

**Author:** [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Replies:** 21\
**Last updated:** [September 2, 2021, 3:25pm UTC](https://discourse.julialang.org/t/julia-vs-c-speed/67219 "2021-09-02T15:25:46Z")

</div>

Hi! I am currently doing a very “nice” project of converting algorithms written in Julia to C++ :cry: I need those algorithms in an embedded environment and, unfortunately, Julia cannot generate compiled code that can b…

---

## [Why this code does a segfault?](https://discourse.julialang.org/t/why-this-code-does-a-segfault/66394)

<div class="topic-metadata">

**Author:** [@Lecrapouille](https://discourse.julialang.org/u/Lecrapouille)\
**Replies:** 21\
**Last updated:** [August 15, 2021, 11:46am UTC](https://discourse.julialang.org/t/why-this-code-does-a-segfault/66394 "2021-08-15T11:46:06Z")

</div>

Why this code does a segfault ? foo.c #include \<stdio.h\> struct mystruct { int a; int b; }; typedef struct mystruct mystruct\_t; int recvstruct(mystruct\_t\* st) { printf("C %u, %u\\n", st-\>a, st-\>b); ret…

---

## [Use two system images programmatically in C](https://discourse.julialang.org/t/use-two-system-images-programmatically-in-c/64374)

<div class="topic-metadata">

**Author:** [@benoit](https://discourse.julialang.org/u/benoit)\
**Replies:** 0\
**Last updated:** [July 9, 2021, 6:34pm UTC](https://discourse.julialang.org/t/use-two-system-images-programmatically-in-c/64374 "2021-07-09T18:34:50Z")

</div>

I saw that it is possible to boot Julia with up to 2 sysimages by using the -J argument. I was wondering if it possible to do the same thing programmatically in C? I did not see any options other than jl\_options.image\_…

---

## [RegisterWindowMessage and SendMessage](https://discourse.julialang.org/t/registerwindowmessage-and-sendmessage/64299)

<div class="topic-metadata">

**Author:** [@crivens](https://discourse.julialang.org/u/crivens)\
**Replies:** 3\
**Last updated:** [July 9, 2021, 1:16pm UTC](https://discourse.julialang.org/t/registerwindowmessage-and-sendmessage/64299 "2021-07-09T13:16:52Z")

</div>

Hey there! Some background so you can better answer my question: I’m a beginner in Julia (with a long background in hobbyist coding in various languages). I set myself to learn the language by creating an automation mo…

---

## [On Julia interoperability with C and PyCall](https://discourse.julialang.org/t/on-julia-interoperability-with-c-and-pycall/64013)

<div class="topic-metadata">

**Author:** [@filchristou](https://discourse.julialang.org/u/filchristou)\
**Replies:** 8\
**Last updated:** [July 6, 2021, 6:19pm UTC](https://discourse.julialang.org/t/on-julia-interoperability-with-c-and-pycall/64013 "2021-07-06T18:19:28Z")

</div>

Hi. I wanted to try Julia for some time, but since now it starts having more of a reason for me, some questions popped up. why Julia native instead of C libraries ? The problem with python was that it was slow. The s…

---

## [Unsuppress compiler error messages in Clang.jl](https://discourse.julialang.org/t/unsuppress-compiler-error-messages-in-clang-jl/63934)

<div class="topic-metadata">

**Author:** [@elkawee](https://discourse.julialang.org/u/elkawee)\
**Replies:** 3\
**Last updated:** [July 2, 2021, 5:27pm UTC](https://discourse.julialang.org/t/unsuppress-compiler-error-messages-in-clang-jl/63934 "2021-07-02T17:27:00Z")

</div>

Hi :slight\_smile: I’m pretty sure i’m the 100th guy who asks this, but i can’t find anything. I ripped out the relevant parts to be able to call trans\_unit.jl/parse\_header(..) directly, and when i do, the usual clang …

---

## [Call C Function that takes NULL as an argument](https://discourse.julialang.org/t/call-c-function-that-takes-null-as-an-argument/62039)

<div class="topic-metadata">

**Author:** [@rwalters31](https://discourse.julialang.org/u/rwalters31)\
**Replies:** 16\
**Last updated:** [June 18, 2021, 7:56pm UTC](https://discourse.julialang.org/t/call-c-function-that-takes-null-as-an-argument/62039 "2021-06-18T19:56:39Z")

</div>

I am trying to have my Julia code communicate with an external program. The external program provides a C API for the inter-process communications. The documentation is a bit sparse but it says: “Call flc\_attach(NULL,…

---

## [What is the best way to wrap C double pointers into a Julia \`Matrix\`?](https://discourse.julialang.org/t/what-is-the-best-way-to-wrap-c-double-pointers-into-a-julia-matrix/62472)

<div class="topic-metadata">

**Author:** [@sapo](https://discourse.julialang.org/u/sapo)\
**Replies:** 3\
**Last updated:** [June 8, 2021, 7:38pm UTC](https://discourse.julialang.org/t/what-is-the-best-way-to-wrap-c-double-pointers-into-a-julia-matrix/62472 "2021-06-08T19:38:01Z")

</div>

Take this code which represents a matrix in C. int\*\* mat = (int\*\*) malloc(rows \* sizeof(int\*)) for (int index=0;index\<row;++index) { mat\[index\] = (int\*) malloc(cols \* sizeof(int)); } What is the best way to wrap m…

---

## [Recommended workflow to prepare a package to use it as a dll with PackageCompiler.jl](https://discourse.julialang.org/t/recommended-workflow-to-prepare-a-package-to-use-it-as-a-dll-with-packagecompiler-jl/59260)

<div class="topic-metadata">

**Author:** [@BambOoxX](https://discourse.julialang.org/u/BambOoxX)\
**Replies:** 0\
**Last updated:** [April 14, 2021, 9:42am UTC](https://discourse.julialang.org/t/recommended-workflow-to-prepare-a-package-to-use-it-as-a-dll-with-packagecompiler-jl/59260 "2021-04-14T09:42:40Z")

</div>

I am currently trying to compile one of my packages for use as dll with PackageCompiler.jl. This somewhat a follow up post of Package Compiler error when reproducing documentation example, yet more generic. During the …

---

## [Passing complex struct to C function results in segfault](https://discourse.julialang.org/t/passing-complex-struct-to-c-function-results-in-segfault/58100)

<div class="topic-metadata">

**Author:** [@oekenta](https://discourse.julialang.org/u/oekenta)\
**Replies:** 3\
**Last updated:** [March 28, 2021, 5:50pm UTC](https://discourse.julialang.org/t/passing-complex-struct-to-c-function-results-in-segfault/58100 "2021-03-28T17:50:32Z")

</div>

I’m trying to interface with a C API for solving linear systems but I keep running into segfault errors. The algorithm uses a somewhat complex C structure, called LUSOLrec, to keep track of all the relevant data. \_LUSOL…

---

## [Calling Julia functions from a multi-threading scheduler written in C?](https://discourse.julialang.org/t/calling-julia-functions-from-a-multi-threading-scheduler-written-in-c/54114)

<div class="topic-metadata">

**Author:** [@stustd](https://discourse.julialang.org/u/stustd)\
**Replies:** 1\
**Last updated:** [January 28, 2021, 1:16pm UTC](https://discourse.julialang.org/t/calling-julia-functions-from-a-multi-threading-scheduler-written-in-c/54114 "2021-01-28T13:16:18Z")

</div>

I have a scheduler written in C that repetitively executes batches if C functions in multi-threaded fashion: Mutually exclusive groups of C functions update one reactor state (i.e. the total set of C functions is parti…

---

## [Doubt about using Clang.jl](https://discourse.julialang.org/t/doubt-about-using-clang-jl/36599)

<div class="topic-metadata">

**Author:** [@amCap1712](https://discourse.julialang.org/u/amCap1712)\
**Replies:** 15\
**Last updated:** [January 5, 2021, 7:18am UTC](https://discourse.julialang.org/t/doubt-about-using-clang-jl/36599 "2021-01-05T07:18:04Z")

</div>

I am trying to use to Clang.jl to parse header files for GNUAstro. GNUAstro has a dependency called wcslib. When I try to run the generated .jl file, I get the error that wcsperm is not defined. That makes sense because w…

---

## [Clang.jl wrapper generation warnings/missing parts](https://discourse.julialang.org/t/clang-jl-wrapper-generation-warnings-missing-parts/34093)

<div class="topic-metadata">

**Author:** [@rayegun](https://discourse.julialang.org/u/rayegun)\
**Replies:** 9\
**Last updated:** [January 2, 2021, 10:29pm UTC](https://discourse.julialang.org/t/clang-jl-wrapper-generation-warnings-missing-parts/34093 "2021-01-02T22:29:25Z")

</div>

I’m trying to wrap this this GraphBLAS.h file using Clang.jl (There is already a wrapper package, but I want to try generating it automatically). I used this code: const z = "/usr/lib/clang/9.0.0/include" const y = "/ho…

---

## [Call Julia function with keywords from C++](https://discourse.julialang.org/t/call-julia-function-with-keywords-from-c/20981)

<div class="topic-metadata">

**Author:** [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Replies:** 3\
**Last updated:** [November 28, 2020, 6:03pm UTC](https://discourse.julialang.org/t/call-julia-function-with-keywords-from-c/20981 "2020-11-28T18:03:03Z")

</div>

Hi guys! Let’s say I have Julia function: function teste(a::Int,b::Int; c = 1.0, d = 1.0, e = 1.0) return (a+b)^(c+d+e) end How can I call it from C++ modifying the keyword d?

---

## [Wrapping a recursive struct with Clang.jl](https://discourse.julialang.org/t/wrapping-a-recursive-struct-with-clang-jl/40680)

<div class="topic-metadata">

**Author:** [@KajWiik](https://discourse.julialang.org/u/KajWiik)\
**Replies:** 1\
**Last updated:** [June 3, 2020, 3:38pm UTC](https://discourse.julialang.org/t/wrapping-a-recursive-struct-with-clang-jl/40680 "2020-06-03T15:38:59Z")

</div>

I am trying to wrap a C library containing several recursive structs like this: struct B; typedef struct A { int foo; struct B \*b; } A; typedef struct B { int faa; A \*a; } B; produces wrapper like this # Aut…

[Previous page](https://discourse.julialang.org/tag/c/610.md?match_all_tags=true&page=2&tags%5B%5D=c)

[Next page](https://discourse.julialang.org/tag/c/610.md?match_all_tags=true&page=4&tags%5B%5D=c)
