[Chicken-users] Compiling multiple modules into a single executable

2016-10-16 Thread Josh Barrett
I really like modules. I tend to use several per project, if not one per file. However, when it comes time to compile an executable, I'd rather not have 50 random .so files cluttering up the place. I've tried using compilation units (which seems to be the endorsed method of compiling multiple

Re: [Chicken-users] Compiling multiple modules into a single executable

2016-10-16 Thread Christian Kellermann
* Josh Barrett [161016 21:57]: > I really like modules. I tend to use several per project, if not one per > file. However, when it comes time to compile an executable, I'd rather not > have 50 random .so files cluttering up the place. I've tried using > compilation units

Re: [Chicken-users] Compiling multiple modules into a single executable

2016-10-16 Thread Thomas Chust
On 2016-10-16 22:52, Josh Barrett wrote: > [...] > $ csc -c foo.scm bar.scm > > Syntax error (import): cannot import from undefined module > --- > As I understand it, this should work, but it obviously doesn't. Does > anybody know why? > [...] Hello, this cannot work because the compiler cannot

Re: [Chicken-users] Compiling multiple modules into a single executable

2016-10-16 Thread Josh Barrett
Oh. Thanks. Can you generate a .import without compiling your module? On Sun, Oct 16, 2016, 17:08 Thomas Chust wrote: > On 2016-10-16 22:52, Josh Barrett wrote: > > [...] > > $ csc -c foo.scm bar.scm > > > > Syntax error (import): cannot import from undefined module > > --- > > As

Re: [Chicken-users] Compiling multiple modules into a single executable

2016-10-16 Thread Josh Barrett
Of course I can. Hopefully, it will help: --- $ cat foo.scm (declare (unit foo)) (module foo (quux) (import chicken scheme) (define (quux) (display "quux"))) $ cat bar.scm (declare (unit bar)) (declare (uses foo)) (module bar (baz) (import chicken scheme) (import foo) (define

Re: [Chicken-users] Compiling multiple modules into a single executable

2016-10-16 Thread Evan Hanson
Hi Josh, On 2016-10-16 21:13, Josh Barrett wrote: > Oh. Thanks. Can you generate a .import without compiling your module? You can use the "-analyze-only" flag: $ csc -analyze-only -emit-import-library foo foo.scm Note that you must specify the modules whose import libraries should be

Re: [Chicken-users] Compiling multiple modules into a single executable

2016-10-16 Thread Josh Barrett
Yes, but that would make it unfeasable to run the code without compiling, which is kind of the point. At this point, I'm thinking of just (cond-expand)ing a (load) in when I'm running in csi. Lazy and inefficient? Yes. Effective? Also yes. On Sun, Oct 16, 2016, 17:37 Thomas Chust

Re: [Chicken-users] Compiling multiple modules into a single executable

2016-10-16 Thread Thomas Chust
On 2016-10-16 23:13, Josh Barrett wrote: > [...] > Can you generate a .import without compiling your module? > [...] Hello Josh, as far as I know, the .import.scm files are always generated as a side effect of compiling a source file. However, it may be possible to discard the primary results

Re: [Chicken-users] Compiling multiple modules into a single executable

2016-10-16 Thread John Cowan
On Sun, Oct 16, 2016 at 5:35 PM, Evan Hanson wrote: You can use the "-analyze-only" flag: > >$ csc -analyze-only -emit-import-library foo foo.scm > If you use -check-syntax (or equivalently -P) then you can use -J to generate all import libraries. This is what I