[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: where to put object file

On Sat, 2005-07-23 at 13:57 -0500, Peter Samuelson wrote:
> [skaller]
> > That isn't really possible: the file contains main(), and there could
> > be more than one such file which do different things (in fact there
> > are, but only one is 'standard' at the moment).

> liby is presented as a static library in /usr/lib/.  If you had your
> own main function but still said -ly on the command line, the linker
> would just ignore the main function in /usr/lib/liby.a.  

Ouch.. main in a library .. well, actually that's
an interesting idea you describe .. but .. (lol):

> I'd suggest the same for your object file - wrap it in a simple
> /usr/lib/libflx_run.a file and have done.  Much more convenient for use
> with linkers, and the linker will still ignore the library's main
> function if you've got another main function you're linking in.

I don't want to do that because it makes sense only
if there is really a 'main' main (lol). I mean,
if there is a default main.

Now in later versions of the system, I may provide
several sample 'main' functions .. so the problem
would just come back.

It might confuse a client using this:

g++ -lrtl mymain.o mycode.o

usually; providing their own 'main()' function in 'mymain.o',
if they accidently wrote:

g++ -lrtl mycode.o

they'd get the main() function from 'librtl' instead.
It may even link .. but the executable would be
unlikely to work .. I'd prefer that they got
an error at link time.

However, it is an interesting idea: thanks!

John Skaller <skaller at users dot sourceforge dot net>

Attachment: signature.asc
Description: This is a digitally signed message part

Reply to: