rainwarrior wrote:
The convenience of this is mitigated by having to create so many separate files, but it's available, at least. It's quite useful when linking with the CRT libraries.
One trick that can be used to avoid having to create many files is to do something like this (example in C, but should be adaptable to assembly).
Code:
// my_funcs.c
#if defined FUNC_FOO
int foo(void) {
return 123;
}
#elif defined FUNC_BAR
int bar(int xxx) {
return xxx+1;
}
#endif
Then you'd simply compile the same file multiple times, defining FUNC_FOO or FUNC_BAR from the command line to decide which function should end up in the object file. Never did this myself, but I've seen it done elsewhere for libraries.
BTW, IIRC ld65 will only drop unused object files if they come from a library. If the object file is explicitly specified in the command line it will always be included.