git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Christian Hesse <list@eworm.de>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, Christian Hesse <mail@eworm.de>
Subject: Re: [PATCH 1/1] do not add common-main to lib
Date: Mon, 15 Aug 2016 14:21:25 +0200	[thread overview]
Message-ID: <20160815142125.0ca30e0f@leda.localdomain> (raw)
In-Reply-To: <20160815120223.4lr23aiqmqzjprch@sigill.intra.peff.net>

[-- Attachment #1: Type: text/plain, Size: 1778 bytes --]

Jeff King <peff@peff.net> on Mon, 2016/08/15 08:02:
> On Mon, Aug 15, 2016 at 09:52:07AM +0200, Christian Hesse wrote:
> 
> > From: Christian Hesse <mail@eworm.de>
> > 
> > Commit 08aade70 (mingw: declare main()'s argv as const) changed
> > declaration of main function. This breaks linking external projects
> > (e.g. cgit) to libgit.a with:
> > 
> > error: Multiple definition of `main'  
> 
> I'd expect the culprit is actually 3f2e229 (add an extra level of
> indirection to main(), 2016-07-01).

Ah, probably you are right...

> > So do not add common-main to lib and let projects have their own
> > main function.  
> 
> That is certainly an option, but I think it means that those projects
> are potentially buggy in the same way that some git commands were prior
> to the common-main series. Namely, the common main() may do some
> run-time setup that parts of libgit.a assume has been done.

Ok, got it.

> I would not be surprised if cgit crashes on Windows, for instance, for
> the reasons detailed in 650c449 (common-main: call
> git_extract_argv0_path(), 2016-07-01). I would also not be surprised if
> nobody actually builds cgit on Windows. :)

I never tried and probably nobody else did. :-p

> The "right" way to do it (according to the way libgit.a views the world)
> is for cgit's main to become cmd_main(), and let libgit.a do its
> run-time startup before getting there.

Looks like that does the job. I will give it some more testing.

Please ignore my patch... ;)
Thanks a lot!
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Best regards             my address:    */=0;b=c[a++];)
putchar(b-1/(/*    Chris            cc -ox -xc - && ./x    */b/42*2-3)*42);}

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2016-08-15 12:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-15  7:52 [PATCH 1/1] do not add common-main to lib Christian Hesse
2016-08-15 12:02 ` Jeff King
2016-08-15 12:21   ` Christian Hesse [this message]
2016-08-15 12:20 ` Johannes Schindelin
2016-08-15 12:30   ` Christian Hesse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160815142125.0ca30e0f@leda.localdomain \
    --to=list@eworm.de \
    --cc=git@vger.kernel.org \
    --cc=mail@eworm.de \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).