Re: [cc65] Chicken and Egg Problem (?)

From: Oliver Schmidt <ol.sc1web.de>
Date: 2009-08-28 11:41:02
Hi Uz,

> I've checked the possibility of adding such a linker config option and - for
> now - it's too much work. The linker config is read *after* the command line
> is parsed and all object files and libraries are read. At that point, all
> modules that should be linked are already determined. Adding an additional
> import in this stage is not possible. Changing the order (reading the config
> before all other stuff) is not easily possible, since it relies on information
> from the modules.

I see. Thanks for the detailed explanation - and your investigation !

> So I've added a linker command line option "--force-import" instead. As a nice
> side effect, this does also spare us the discussion about having a forced
> import of "_main" in the builtin linker or not. For applications that have
> main() in a library, just add "--force-import _main" (or "--force-import
> __STARTUP__") to the linker or cl65 command line, and things should be ok.

This approach is most likely the very sweet spot of optimizing the
ratio between effort and result :-)

...and by the way quite popular: For example gcc comes with linker
option -u. I'm using it for Contiki when I want certain stuff to be
linked into the main program to have it available for shared libraries
loaded on demand:
http://contiki.cvs.sourceforge.net/viewvc/contiki/contiki-2.x/platform/win32/Makefile.win32

Is this going to be an "official" option? If yes it would be nice if
the documentation would mention the "main() in library" scenario as an
example / a potential usecase.

Best, Oliver
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri Aug 28 11:41:09 2009

This archive was generated by hypermail 2.1.8 : 2009-08-28 11:41:11 CEST