• Re: Linking External File

    From Jason Martin@21:1/5 to Sidney Reilley on Tue Feb 11 12:50:26 2025
    On 2025-02-11, Sidney Reilley <sidney.reilley.ii@gmail.com> wrote:

    I've got a script that uses `link' to include a file containing a few procedures. This library that I'm trying to link lives in the same
    directory as the script file. I compiled the library using `icont -c
    <filename.icn>' which created filename.u1 and filename.u2.
    However, the code does not seem to be linked in as the script outputs
    wrong data. What am I doing wrong? TIA ..

    -- Duke

    Page 184 of the Icon book 3rd edition
    [It will be Page 206 in your PDF viewer]
    CREATING NEW LIBRARY MODULES
    Keep reading about IPATH after that.
    They may need to be in IPATH.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jason Martin@21:1/5 to Jason Martin on Wed Feb 12 14:44:25 2025
    On 2025-02-12, Jason Martin <jasonm@claudville.va> wrote:
    On 2025-02-12, Sidney Reilley <sidney.reilley.ii@gmail.com> wrote:
    On 2025-02-11, Jason Martin <jasonm@claudville.va> wrote:
    On 2025-02-11, Sidney Reilley <sidney.reilley.ii@gmail.com> wrote:

    I've got a script that uses `link' to include a file containing a few
    procedures. This library that I'm trying to link lives in the same
    directory as the script file. I compiled the library using `icont -c >>>><filename.icn>' which created filename.u1 and filename.u2.
    However, the code does not seem to be linked in as the script outputs
    wrong data. What am I doing wrong? TIA ..

    -- Duke

    Page 184 of the Icon book 3rd edition
    [It will be Page 206 in your PDF viewer]
    CREATING NEW LIBRARY MODULES
    Keep reading about IPATH after that.
    They may need to be in IPATH.

    I've got IPATH pointing to where all the scripts live.
    Any other ideas?

    # mylib.icn
    # Note: Libraries cannot have procedure main()
    procedure one()
    write("ONE")
    end
    procedure two()
    write("TWO")
    end

    icont -c mylib.icn

    # main.icn
    link mylib
    procedure main()
    write("Main")
    write(one())
    write(two())
    end

    icon main.icn
    # Works for me on GhostBSD without IPATH
    Main
    ONE
    TWO

    What operating system?
    What version of ICON?
    Does your program work if all procedures were in one file?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jason Martin@21:1/5 to Sidney Reilley on Wed Feb 12 14:22:04 2025
    On 2025-02-12, Sidney Reilley <sidney.reilley.ii@gmail.com> wrote:
    On 2025-02-11, Jason Martin <jasonm@claudville.va> wrote:
    On 2025-02-11, Sidney Reilley <sidney.reilley.ii@gmail.com> wrote:

    I've got a script that uses `link' to include a file containing a few
    procedures. This library that I'm trying to link lives in the same
    directory as the script file. I compiled the library using `icont -c >>><filename.icn>' which created filename.u1 and filename.u2.
    However, the code does not seem to be linked in as the script outputs
    wrong data. What am I doing wrong? TIA ..

    -- Duke

    Page 184 of the Icon book 3rd edition
    [It will be Page 206 in your PDF viewer]
    CREATING NEW LIBRARY MODULES
    Keep reading about IPATH after that.
    They may need to be in IPATH.

    I've got IPATH pointing to where all the scripts live.
    Any other ideas?

    # mylib.icn
    # Note: Libraries cannot have procedure main()
    procedure one()
    write("ONE")
    end
    procedure two()
    write("TWO")
    end

    icont -c mylib.icn

    # main.icn
    link mylib
    procedure main()
    write("Main")
    write(one())
    write(two())
    end

    icon main.icn
    # Works for me on GhostBSD without IPATH
    Main
    ONE
    TWO

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)