Julia 1.8.2 message ERROR: LoadError: too many parameters for type

Hi! The header file (.h) of a C shared library contains the following declaration:

typedef struct {
  int path;			/**< MISR path number */
  long long projcode;		/**< GCTP projection code */
  long long zonecode;		/**< GCTP zone code */
  long long spherecode;		/**< GCTP sphere code */
  double projparam[15];		/**< GCTP projection parameters */
  double ulc[2];		/**< MISR ulc_xy of first block */
  double lrc[2];		/**< MISR lrc_xy of first block */
  int nblock;			/**< MISR number blocks */
  int nline;			/**< MISR number lines */
  int nsample;			/**< MISR number samples */
  float reloffset[179];		/**< MISR relative block offset */
  int resolution;		/**< MISR resolution */
} MTKt_MisrProjParam;

which I have translated into

struct MTKt_MisrProjParam
    path::Cint
    projcode::Clonglong
    zonecode::Clonglong
    spherecode::Clonglong
    projparam::Vector{15, Cdouble}
    ulc::Vector{2, Cdouble}
    lrc::Vector{2, Cdouble}
    nblock::Cint
    nline::Cint
    nsample::Cint
    reloffset::Vector{179, Cfloat}
    resolution::Cint
end

However, each time I try to use the module containing that declaration, I get the error message

ERROR: LoadError: too many parameters for type

This error comes from anyone of the 4 lines containing Vector because commenting them out removes the error. So what should the correct syntax be to include a vector in a struct? Thanks for suggestions.

Vector only accept one parameter which is the type of the element. So it should be Vector{T}. The struct below can work

struct MTKt_MisrProjParam
           path::Cint
           projcode::Clonglong
           zonecode::Clonglong
           spherecode::Clonglong
           projparam::Vector{Cdouble}
           ulc::Vector{Cdouble}
           lrc::Vector{Cdouble}
           nblock::Cint
           nline::Cint
           nsample::Cint
           reloffset::Vector{Cfloat}
           resolution::Cint
       end

You should use a static vector for this purpose. A Vector will only place a pointer in the julia struct, whereas the vector itself will be on the heap. Either an SVector or an MVector:

using StaticArrays
struct ...
   path::Cint
   ...
   projparam::SVector{15, Cdouble}
   ...
end

@yusri-dh and @sgaure: Thank you both for these valuable inputs. I knew of Vector but not SVector, so thanks for introducing me to that package.

But heed the warnings mentioned in StaticArrays.jl’s readme about vector length. With 179 elements your field reloffset is likely too long for a SVector to be performant.