A new question about the libjulia c-api. My project is fully functional and I’m able to interact with the c-api in my VS2017 / C++ solution.

I work on a C++ wrapper of the ACME package that (intensively) use sparse matrix, but I can’t see how to “unbox” the SparseMatrixCSC with the c-api.

The package contains two major circuit functions that create : one “incidence” matrix (sparse), and two “topology” matrices (sparse). The first one return a SparseMatrixCSC of integers. The second return a tuple of two SparseMatrixCSC of Integer. The “topomat” function call the “incidence” function that is used to produce the two topologicals matrices.

My C/C++ method call the “topomat” function to get a tuple :

```
jl_value_t* topo = jl_eval_string((ACME_ID + ".topomat(" + id + ")").c_str());
```

I get a jl_value_t* pointer that is a tuple - alright. As I know, the tuple contains two matrices :

```
size_t num_mat = jl_nfields(topo);
```

Return 2. OK.

```
jl_value_t* mat1 = jl_get_nth_field(topo, 0);
jl_value_t* mat2 = jl_get_nth_field(topo, 1);
```

Return 2 valid pointers where jl_typeof_str return => **SparseMatrixCSC**

But now, I’m confused. How to use thèses pointers?

A call to :

```
jl_is_mutable(mat1)
```

return true.

If I call :

```
jl_value_t* eltype = (jl_value_t*)jl_array_eltype(mat1);
```

Return a value pointer that is now typed : **bitstype**

If I call :

```
jl_value_t *ty = jl_typeof(val1);
int sz = jl_datatype_size(ty);
```

I get a sz integer of => **20**

But I really don’t know how to work with a 2D array (matrix) with my pointers. The current Embedded documentation talk about the C->libjulia 1D array.

If someone can help me with a little example of code, I would be delighted.