# How to use the app generated by PackageCompiler.jl?

**URL:** <https://discourse.julialang.org/t/how-to-use-the-app-generated-by-packagecompiler-jl/76994>\
**Category:** General Usage\
**Tags:** question, package, package-compiler, app\
**Created:** [February 23, 2022, 9:32pm UTC](https://discourse.julialang.org/t/how-to-use-the-app-generated-by-packagecompiler-jl/76994 "2022-02-23T21:32:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Carol](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carol/32/8140_2.png) [@Carol](https://discourse.julialang.org/u/Carol)\
**Post date:** [February 23, 2022, 9:32pm UTC](https://discourse.julialang.org/t/how-to-use-the-app-generated-by-packagecompiler-jl/76994/1 "2022-02-23T21:32:03Z")

</div>

Hi,

I want to make an app for my Julia package named “MyApp”. Below is the simplified usage of MyApp in Julia:

```julia
using MyApp, DataFrames, CSV, Distributions

a = CSV.read("data.csv", Dataframe)
b = "y=x"
c = 1

d = Normal(c,c)
e = function1(a)
f = function2(b)

```

Following the documentation of [PackgeCompiler.jl](https://julialang.github.io/PackageCompiler.jl/dev/apps.html#Creating-an-app), I cloned MyApp from Github, and ran `create_app("MyApp", "MyAppCompiled")`. Now I have a folder “MyAppComplied” with sub-folder “bin”,“lib” and “share”, and there are two exe files in the “bin” folder named `MyApp` and `julia`.

Sorry I have no experience with this, and my question is how to use `MyApp` to do my previous analysis as shown in above code?

Thanks,  
Carol

---

<div class="post-metadata">

**Author:** ![ffevotte](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ffevotte/32/6587_2.png) [@ffevotte](https://discourse.julialang.org/u/ffevotte)\
**Post date:** [February 24, 2022, 2:34pm UTC](https://discourse.julialang.org/t/how-to-use-the-app-generated-by-packagecompiler-jl/76994/2 "2022-02-24T14:34:43Z")

</div>

You’ll need to have a “main” function in your package; according to the usage example you gave, it could look like the following:

```julia
function julia_main()::Cint
    # Get arguments from the command-line
    # (you'll probably want to handle errors, e.g. in case users don't
    # provide enough arguments)
    filename = ARGS[1] # data file provided as argument, instead of hardcoding "data.csv"
    param = parse(Int, ARGS[2]) # numeric parameter instead of hardcoding c=1

    # Use your package to do what you need to do
    a = CSV.read(filename, Dataframe)
    b = "y=x"
    c = param
    
    d = Normal(c,c)
    e = function1(a)
    f = function2(b)

    # Display results in the end
    @show f

    # Return a success/error code
    # 0 indicates that everything went well
    # any other value indicates an error
    return 0
end

```

After having created the app using PackageCompiler, the executable is found in `MyAppCompiled/bin/MyApp`. The way you run it will depend a bit on the OS you’re using, but the command-line would look like this:

```julia
/path/to/MyAppCompiled/bin/MyApp /path/to/data.csv 1

```
