# Signature for \`jl\_array\_data\` is different in stable and nightly

**URL:** https://discourse.julialang.org/t/signature-for-jl-array-data-is-different-in-stable-and-nightly/108519
**Category:** Internals & Design
**Tags:** embedding, versions
**Created:** [January 8, 2024, 1:55pm UTC](https://discourse.julialang.org/t/signature-for-jl-array-data-is-different-in-stable-and-nightly/108519 "2024-01-08T13:55:37Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![dmitry-kabanov](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dmitry-kabanov/32/52639_2.png) [@dmitry-kabanov](https://discourse.julialang.org/u/dmitry-kabanov)
#### Post date: [January 8, 2024, 1:55pm UTC](https://discourse.julialang.org/t/signature-for-jl-array-data-is-different-in-stable-and-nightly/108519/1 "2024-01-08T13:55:37Z")

</div>

Hi, I have some C code with Julia embedding. The code is tested with versions 1.8 and nightly. However, it fails on nightly, due to the changes in the signature of `jl_array_data` (macro that obtains a C pointer from a Julia Array data structure).

Precisely, as I was able to trace from the GitHub repo, somehow in the current stable release 1.10, there is only macro `jl_array_data(a)` , but in the `master` branch (I assume that this branch is used for nightly builds) this macro is renamed to `jl_array_data_(a)` (mind the ending underscore) and the old name is used for a new macro `jl_array_data(a, t)` where `t` is a data type.

Question: How to handle this robustly in the code that I am maintaining? I mean, I still want tests to pass with a stable release and nightly. I understand that the question is more about C than Julia; however due to the lack of experience with Julia, I’d like to ask someone’s opinion about how to handle this API changes in a robust long-term way.

---

<div class="post-metadata">

### Author: ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)
#### Post date: [January 8, 2024, 2:34pm UTC](https://discourse.julialang.org/t/signature-for-jl-array-data-is-different-in-stable-and-nightly/108519/2 "2024-01-08T14:34:39Z")

</div>

I don’t think it’s more complicated than

```julia
#ifndef jl_array_data_
#define jl_array_data_ jl_array_data
#endif

```

and changing your code everywhere to use the underscore-ending macro. But my C is rusty, so I could be off.

Considering that there are no stability guarantees for `julia.h`, my opinionated recommendation is to use it as little as possible in embedding and do all calls between C and Julia using [`@cfunction`](https://docs.julialang.org/en/v1/manual/calling-c-and-fortran-code/#Creating-C-Compatible-Julia-Function-Pointers) pointers. I.e. handle data in C form in the Julia code rather than handle data in Julia form in the C code.

---

<div class="post-metadata">

### Author: ![dmitry-kabanov](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dmitry-kabanov/32/52639_2.png) [@dmitry-kabanov](https://discourse.julialang.org/u/dmitry-kabanov)
#### Post date: [January 8, 2024, 3:16pm UTC](https://discourse.julialang.org/t/signature-for-jl-array-data-is-different-in-stable-and-nightly/108519/3 "2024-01-08T15:16:21Z")

</div>

Thank you, @GunnarFarneback! Yes, it seems like the easiest and robust enough.

Regarding handling data, I agree. However, I need to handle data on C side and pass them to Julia.

---

<div class="post-metadata">

### Author: ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)
#### Post date: [January 8, 2024, 6:41pm UTC](https://discourse.julialang.org/t/signature-for-jl-array-data-is-different-in-stable-and-nightly/108519/4 "2024-01-08T18:41:32Z")

</div>

You know your code best but it’s usually possible to pass an element count (or dimensions) and a memory pointer and let the Julia code create the Julia array with `unsafe_wrap` or via `unsafe_load`.
