Skip to content

Add a (build-flag controlled) option to have the produced binary app support julia flags #680

@NHDaly

Description

@NHDaly

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:

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;

#endif

and 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions