On Monday, April 12, 2004, at 04:57 AM, Leopold Toetsch wrote:
Will Coleda <[EMAIL PROTECTED]> wrote:--
dyld: ./parrot Undefined symbols: _Parrot_tclobject_morph _Parrot_tclobject_set_pmc
Ah yes. That's ugly. So here we go:
0) The PMCs were pre-ICU. I've adapted them. Should I check it in or send it back to you?
1) dynamic PMCs need a "dynpmc" flag on the class definition line. This causes the PMC compiler to add additional code for dynamic loading:
pmclass TclString extends tclobject dynpmc {
2) Nasty dependencies. I got around that by changing the Makefile like so:
tclobject$(SO) : tclobject.c $(LD) $(LD_SHARED) $(LD_SHARED_FLAGS) $(LDFLAGS) -Wl,-E -o $@ \ -I../include -I../classes \ -L../blib/lib -lparrot $< $(PERL) -MFile::Copy=cp -e 'cp q|$@|, q|../runtime/parrot/dynext/$@|' cd ../runtime/parrot/dynext; ln -sf tclobject.so libtclobject.so
%$(SO) : %.c $(LD) $(LD_SHARED) $(LD_SHARED_FLAGS) $(LDFLAGS) -Wl,-E -o $@ \ -I../include -I../classes \ -L../blib/lib -lparrot -L../runtime/parrot/dynext \ -ltclobject $< $(PERL) -MFile::Copy=cp -e 'cp q|$@|, q|../runtime/parrot/dynext/$@
(and disabling non-tcl shared classes for now)
That is for all tcl* but tclobject libtclobject.so is added as a library. This might also need the LD_LIBRARY_PATH to contain F<runtime/parrot/dynext>.
I don't know how we do that platform independend.
It might be simpler to have a utility that copies all tcl*.c together into one and chains the Parrot_lib_<type>_load() functions. So only one shared lib would be loaded that registers all classes. Should be a rather simple script.
E.g. merge-classes -o tcl-all.c tclobject.c tclstring.c ...
Then compile and loadlib only the tcl-all. This would need a Parrot_lib_tcl-all_load() function that calls _load() for all contained PMCs.
3) For now $ cat tcl.pasm loadlib P10, "tclobject" print "ok 1\n" loadlib P11, "tclstring" print "ok 2\n" new P1, .TclString set P1, "ok 3\n" set S1, P1 print S1 end
$ parrot tcl.pasm ok 1 ok 2 ok 3
leo
Will "Coke" Coleda will at coleda dot com