[m-users.] How do I use a module's main/2 in another module's main/2?

Zoltan Somogyi zoltan.somogyi at runbox.com
Fri Jul 12 19:29:14 AEST 2019



On Fri, 12 Jul 2019 03:31:22 -0500, Julian Fondren <jfondren at minimaltype.com> wrote:
> Is hello_repeatedly currently possible, without altering hello.m?

Not in that form. Every program must have exactly one predicate named "main",
since this is the program's entry point.

However, the sharing of functionality you want is definitely possible. You simply have

- two different modules containing "main", say prog1.m and prog2.m, and
- any number of other modules, say shared1.m, shared2.m, ..., sharedN.m.

Then you can build the executable prog1 using prog1.m and shared*.m,
and the executable prog2 using prog2.m and shared*.m.

Zoltan.


More information about the users mailing list