Skip to content
This repository was archived by the owner on Mar 4, 2019. It is now read-only.
This repository was archived by the owner on Mar 4, 2019. It is now read-only.

Passing command line arguments #44

@TransGirlCodes

Description

@TransGirlCodes

Hi,

I've just tried to make a binary which accepts command line arguments and I get segfaults which has led me to notice:

In hello.jl:

Base.@ccallable function julia_main(ARGS::Vector{String})::Cint
    println("hello, world")
    @show f()
    println(lineplot(1:10, (1:10).^2))
    return 0
end

So I should expect to accept ARGS and pass it through to use with say ArgParse.jl.
However, when I look at program.c:

int main(int argc, char *argv[])
{
    intptr_t v;

    // Initialize Julia
    uv_setup_args(argc, argv); // no-op on Windows
    libsupport_init();
    jl_options.image_file = "libhello";
    julia_init(JL_IMAGE_CWD);

    // Do some work
    julia_main();

    // Cleanup and graceful exit
    jl_atexit_hook(0);
    return 0;
}

Nothing is passed to julia_main when it is invoked - perhaps why I'm getting segfault!? So does the call of julia_main() need to be altered to accept some arguments? If so, how?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions