static-julia icon indicating copy to clipboard operation
static-julia copied to clipboard

Warning compiling program.c with ARGS

Open joaquimg opened this issue 8 years ago • 1 comments

I copied from program2.c the follwing step:

  jl_value_t *type = jl_apply_array_type(jl_string_type, 1);
  jl_array_t *ARGS = jl_alloc_array_1d(type, 0);
  JL_GC_PUSH1(&ARGS);
  jl_array_grow_end(ARGS, argc - 1);
  for (i = 1; i < argc; i++) {
      jl_value_t *s = (jl_value_t*)jl_cstr_to_string(argv[i]);
      jl_arrayset(ARGS, s, i - 1);
  }

I keep getting this warning:

D:\myprog\compile2\program.c: In function 'main':
D:\myprog\compile2\program.c:68:42: warning: passing argument 1 of 'jl_apply_array_type' from incompatible pointer type [-Wincompatible-pointer-types]
   jl_value_t *type = jl_apply_array_type(jl_string_type, 1);
                                          ^~~~~~~~~~~~~~
In file included from D:\myprog\compile2\program.c:17:0:
D:\myprog\deps\julia\julia-0.6.0-win64\include\julia/julia.h:1199:26: note: expected 'jl_value_t * {aka struct _jl_value_t *}' but argument is of type 'jl_datatype_t * {aka struct _jl_datatype_t *}'
 JL_DLLEXPORT jl_value_t *jl_apply_array_type(jl_value_t *type, size_t dim);
                          ^~~~~~~~~~~~~~~~~~~

everything seems to work though.

I am using x86_64-w64-mingw32-gcc from MSYS2 in windows 10 64bits. With julia-0.6.0 64bits and the current master of this script.

joaquimg avatar Oct 23 '17 20:10 joaquimg

I get the following on Linux 64 bits with julia 0.6.0-64bits:

/home/user/myprog.jl/compile/program.c: In function ‘main’:
/home/user/myprog.jl/compile/program.c:71:3: warning: passing argument 1 of ‘jl_apply_array_type’ from incompatible pointer type [enabled by default]
   jl_value_t *type = jl_apply_array_type(jl_string_type, 1);
   ^
In file included from /home/user/myprog.jl/compile/program.c:17:0:
/home/user/julia-903644385b/include/julia/julia.h:1199:26: note: expected ‘struct jl_value_t *’ but argument is of type ‘struct jl_datatype_t *’
 JL_DLLEXPORT jl_value_t *jl_apply_array_type(jl_value_t *type, size_t dim);
                          ^

joaquimg avatar Oct 25 '17 11:10 joaquimg