Hello, Just 1 more question, for me to get it right. When I have 2 modules, for example like this:
---main.imc----------- .sub _main bsr _hellosub end .end .include hello.imc ---------------------- ---hello.imc---------- .sub _hellosub /* print "hello" or whatever */ ret .end -----------------------
The ".include" makes sure that IMCC can resolve the labels and stuff?
Not exactly, the .include just inserts the file in place. It has nothing to do with fixups. The .include already happens in the lexer.
.. (I mean not really *insert* into the file, but in IMCC symbol table or something like that.)
The other way round, the file gets inserted, that's it, no label resolution or such.
Or, can the modules be compiled separately without any error like "missing label" ?
The 2 subs are compiled independendly. When a PBC file is generated or when the program should be run, global fixups (like in your example) are done then. Global label fixup happens after compilation of all compilation units.
s. docs/parsing.pod /compilation unit and t/syn/bsr.t (the 2 last tests are equivalent, the latter is with .include)
Klaas-Jan
leo