Hi Sam, thanks for your reply.
'Sam Clegg' via emscripten-discuss wrote:
> On Fri, Jun 26, 2026 at 11:53⬯AM 'Phil Endecott' via emscripten-discuss <
>
emscripte...@googlegroups.com> wrote:
>
>> Dear Experts,
>>
>> I compile my source files to .o object files and then link with
>> something like:
>>
>> emcc -O3 --preload-file foo.dat --shell-file shell.html abc.o def.o
>> ghi.o -o out.html
>>
>> If I've only changed shell.html or foo.dat, can I avoid re-linking?
>> Since there is a lot of link-time optimisation going on, linking is
>> slow. I'd like to avoid that when it's not needed.
>>
>> I'm wondering if there is some way to link the object files and do
>> the link-time optimisation, and then in a further step add the
>> preload files and shell.html to make the final outputs.
>>
>>
> I would recommend against using `--shell-file` unless ou
> have a really good reason too. Its normally easier to have emcc project a
> `.js` file and then have a fixes `.html` file checked in for you app.
>
> Likewise, do you really need to use `--preload-file`? In most cases I
> recommend using `--embed-file` (unless you really want to deploy your data
> separelyt from your wasm).
I started with the tutorial at
https://emscripten.org/docs/getting_started/Tutorial.html
which uses "-o hello.html" and "--preload-file".
Is there a basic example somewhere of using a fixed .html file? I.e.
what does the HTML need to do to load the .js, and how should emcc
be invoked to generate the required .js?
> I did add an option called `--post-link` which could be just what you want
> here. It lets you pass an already-linked wasm file to `emcc` instead of
> object files. So you would run your build once as above and then for
> followup builds you could pass the `--post-link foo.wasm` instead of the
> object files. This a lesser used option though, so you could run into
> issues with it.
Thanks, I'll look at that too.
Regards, Phil.