In IMCC, how can I get the address of a label in a
different compilation unit? Is there a way to do this
at compile time? I've looked through the latest docs
but according to imcc/docs/parsing.pod, global labels
get stored in global variables that you must look up
at run time (yuck).
It seems that newsub does some magic regarding this,
as
.sub _main
# This doesn't work
set $I1, _baz
print "_baz: "
print $I1
print "\n"
_shindig:
# But this does
newsub $P1, .Sub, _baz
get_addr $I1, $P1
print "_baz (fancy): "
print $I1
print "\n"
exit 0
.end
.sub _main2
_baz:
exit 0
.end
outputs
_baz: -1
_baz (fancy): 136929824
Is there any way I can get that magic without having
to
actually create a new .Sub object?
thanks,
- TOGoS
__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus
Don't. The only way to transfer control to code in a different
compilation unit (arguably in a different sub in the same compilation
unit) is via invoke or one of its relatives.
--
Dan
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
d...@sidhe.org have teddy bears and even
teddy bears get drunk