Embedding julia in C, Segmentation fault when call hcat to concatenate two arrays

Since Julia’s arrays are column-major (1D arrays are column vectors), you probably want to use vcat.

julia> hcat([1, 2, 3, 4], [5, 6])
ERROR: DimensionMismatch("vectors must have same lengths")
Stacktrace:
 [1] hcat(::Vector{Int64}, ::Vector{Int64})
   @ Base .\array.jl:1710
 [2] top-level scope
   @ REPL[45]:1

julia> vcat([1, 2, 3, 4], [5, 6])
6-element Vector{Int64}:
 1
 2
 3
 4
 5
 6