-
-
Notifications
You must be signed in to change notification settings - Fork 198
Description
Sometimes, for debugging, we'd like to enable a julia flag in our statically compiled binary. (In this case, it was --check-bounds=yes.)
But in order to enable it at runtime, in the binary, we would need to edit the embedding_wrapper.c file, here:
PackageCompiler.jl/src/embedding_wrapper.c
Lines 52 to 53 in 7cab589
| jl_options.image_file = JULIAC_PROGRAM_LIBNAME; | |
| julia_init(JL_IMAGE_JULIA_HOME); |
It would be awesome if we instead add a build-time controlled flag, similar to what we did in #551, which would statically enable a feature in the embedding_wrapper.c file to call julia's jl_parse_opts() with arguments passed at the command line? Maybe collecting all the args that start after --jl_args or something like that?
This could look something like this, maybe?:
#ifdef JL_PARSE_JL_ARGS
// find the start of `--jl_args`, if it's present, in `argv`:
int jl_args_start = find_jl_args_start(argc, argv);
int new_argc = argc - jl_args_start;
char **new_argv = argv + jl_args_start;
jl_parse_opts(&new_argc, (char***)&new_argv);
argc = jl_args_start-1;
#endifand then the julia flag would control the JL_PARSE_JL_ARGS macro being defined.
Would you be open to that? Or something similar? Thanks @KristofferC.