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

Re: where to put object file



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

Right, there's no inherent reason main can't go in a library, same as
any other global function or variable.

> 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.

Oh, I didn't mean to imply you couldn't have more than one of these
libraries.  Same as you're planning to perhaps have more than one
object file.  It's really the same thing, but I think it makes life
easier for people doing manual linking to use /usr/lib/libfoo.a rather
than /usr/lib/foo.o or /usr/lib/felix/rtl/foo.o or what have you.  The
difference is being able to say "-lfoo" on the link line rather than
having to supply the complete pathname.

> 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

That's really stretching it.  When was the last time you accidentally
forgot an object file on a link line?  When was the last time you
accidentally forgot the object file with your program's main entry
point?

Peter

Attachment: signature.asc
Description: Digital signature


Reply to: