1 Return-Path: <polatel@gmail.com>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 258E7431FB6
\r
6 for <notmuch@notmuchmail.org>; Tue, 15 May 2012 08:09:10 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001,
\r
13 RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id aegOBUxH8P49 for <notmuch@notmuchmail.org>;
\r
17 Tue, 15 May 2012 08:09:08 -0700 (PDT)
\r
18 Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com
\r
19 [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 7BD52431FAE
\r
22 for <notmuch@notmuchmail.org>; Tue, 15 May 2012 08:09:08 -0700 (PDT)
\r
23 Received: by bkcjk13 with SMTP id jk13so5586826bkc.26
\r
24 for <notmuch@notmuchmail.org>; Tue, 15 May 2012 08:09:05 -0700 (PDT)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
26 h=mime-version:sender:in-reply-to:references:from:date
\r
27 :x-google-sender-auth:message-id:subject:to:cc:content-type
\r
28 :content-transfer-encoding;
\r
29 bh=3gkD5CII2zFxTcnBL75YcxdnYrhR7IccSvvL7guVBDs=;
\r
30 b=TpPZFrsPmSuIVaSVi1NFNdC8JTeumoZ+6EE2N7D/P4nPWzqeY7PNe/ofXNm3FUNsmj
\r
31 5npjk/dsaLiWzDeU0djUIqnM1byFIpT5q2lSCHOuZvKoG2aUFcW/ctDLpnDaIE+SKlrz
\r
32 8ibvfm4jqFPbBmBAHeMnoTgAaUeB9m2CXTMaeyLyCm1vNSshA53WoLN/uFG9CVsipNZR
\r
33 dGNxeF2O0smPzGDDLxLTyAhKf2XbEFATIgIT9xkgn50gy7U2NS6QVFkDxzD+yGQRz4vJ
\r
34 egnf2jgbTFyZgxB4NaUA27hkNga8oJLjCdJ3nesUsLKt6q4lgjjper7isfKBjQs1mp37
\r
36 Received: by 10.204.151.82 with SMTP id b18mr4804109bkw.132.1337094545708;
\r
37 Tue, 15 May 2012 08:09:05 -0700 (PDT)
\r
39 Sender: polatel@gmail.com
\r
40 Received: by 10.204.50.132 with HTTP; Tue, 15 May 2012 08:08:45 -0700 (PDT)
\r
41 In-Reply-To: <20120513171917.GL11804@mit.edu>
\r
42 References: <1336669964-24231-1-git-send-email-tomi.ollila@iki.fi>
\r
43 <20120513171917.GL11804@mit.edu>
\r
44 From: Ali Polatel <alip@exherbo.org>
\r
45 Date: Tue, 15 May 2012 18:08:45 +0300
\r
46 X-Google-Sender-Auth: 0GlUTlfvsv_LZmxS_3xfit9GWqk
\r
48 <CADv3eywyAaqtAhzYJFjVp9xpWcPv35L1CGPYK3PK_GaDrAJOVw@mail.gmail.com>
\r
49 Subject: Re: [PATCH] ruby: extern linkage portability improvement
\r
50 To: Austin Clements <amdragon@mit.edu>
\r
51 Content-Type: text/plain; charset=ISO-8859-1
\r
52 Content-Transfer-Encoding: quoted-printable
\r
53 Cc: Tomi Ollila <tomi.ollila@iki.fi>, notmuch@notmuchmail.org
\r
54 X-BeenThere: notmuch@notmuchmail.org
\r
55 X-Mailman-Version: 2.1.13
\r
57 List-Id: "Use and development of the notmuch mail system."
\r
58 <notmuch.notmuchmail.org>
\r
59 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
60 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
61 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
62 List-Post: <mailto:notmuch@notmuchmail.org>
\r
63 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
64 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
65 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
66 X-List-Received-Date: Tue, 15 May 2012 15:09:10 -0000
\r
68 2012/5/13 Austin Clements <amdragon@mit.edu>:
\r
69 > Quoth Tomi Ollila on May 10 at =A08:12 pm:
\r
70 >> Some C compilers are stricter when it comes to (tentative) definition
\r
71 >> of a variable -- in those compilers introducing variable without 'extern=
\r
73 >> keyword always allocates new 'storage' to the variable and linking all
\r
74 >> these modules fails due to duplicate symbols.
\r
76 >> This change uses some macro trickery to avoid writing every variable twi=
\r
79 >> This is reimplementation of Charlie Allom's patch:
\r
80 >> id:"1336481467-66356-1-git-send-email-charlie@mediasp.com"
\r
82 >> combining information from other change made by Ali Polatel.
\r
85 >> Charlie: could you test whether this patch actually work ? :)
\r
87 >> Everyone: what do you think of the "hiding extern" macro trick ?
\r
89 > This seems like a hacky and nonstandard way to do this. =A0Granted, the
\r
90 > standard way to do this---always declare variables extern in .h files
\r
91 > and also give a non-extern definition in exactly one .c file---is more
\r
92 > verbose, but nobody will be surprised or confused by it.
\r
94 I fully agree or otherwise I'd suggest using:
\r
95 http://minnie.tuhs.org/cgi-bin/utree.pl?file=3DV7/usr/src/cmd/sh/mac.h
\r
97 >> =A0bindings/ruby/defs.h | =A0 56 +++++++++++++++++++++++++++------------=
\r
99 >> =A0bindings/ruby/init.c | =A0 =A02 +
\r
100 >> =A02 files changed, 33 insertions(+), 25 deletions(-)
\r
102 >> diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h
\r
103 >> index 85d8205..2531760 100644
\r
104 >> --- a/bindings/ruby/defs.h
\r
105 >> +++ b/bindings/ruby/defs.h
\r
106 >> @@ -24,31 +24,37 @@
\r
107 >> =A0#include <ruby.h>
\r
108 >> =A0#include "notmuch.h"
\r
110 >> -VALUE notmuch_rb_cDatabase;
\r
111 >> -VALUE notmuch_rb_cDirectory;
\r
112 >> -VALUE notmuch_rb_cFileNames;
\r
113 >> -VALUE notmuch_rb_cQuery;
\r
114 >> -VALUE notmuch_rb_cThreads;
\r
115 >> -VALUE notmuch_rb_cThread;
\r
116 >> -VALUE notmuch_rb_cMessages;
\r
117 >> -VALUE notmuch_rb_cMessage;
\r
118 >> -VALUE notmuch_rb_cTags;
\r
120 >> -VALUE notmuch_rb_eBaseError;
\r
121 >> -VALUE notmuch_rb_eDatabaseError;
\r
122 >> -VALUE notmuch_rb_eMemoryError;
\r
123 >> -VALUE notmuch_rb_eReadOnlyError;
\r
124 >> -VALUE notmuch_rb_eXapianError;
\r
125 >> -VALUE notmuch_rb_eFileError;
\r
126 >> -VALUE notmuch_rb_eFileNotEmailError;
\r
127 >> -VALUE notmuch_rb_eNullPointerError;
\r
128 >> -VALUE notmuch_rb_eTagTooLongError;
\r
129 >> -VALUE notmuch_rb_eUnbalancedFreezeThawError;
\r
130 >> -VALUE notmuch_rb_eUnbalancedAtomicError;
\r
133 >> -ID ID_db_create;
\r
135 >> +#ifdef RUBY_INIT_C
\r
139 >> +extern VALUE notmuch_rb_cDatabase;
\r
140 >> +extern VALUE notmuch_rb_cDirectory;
\r
141 >> +extern VALUE notmuch_rb_cFileNames;
\r
142 >> +extern VALUE notmuch_rb_cQuery;
\r
143 >> +extern VALUE notmuch_rb_cThreads;
\r
144 >> +extern VALUE notmuch_rb_cThread;
\r
145 >> +extern VALUE notmuch_rb_cMessages;
\r
146 >> +extern VALUE notmuch_rb_cMessage;
\r
147 >> +extern VALUE notmuch_rb_cTags;
\r
149 >> +extern VALUE notmuch_rb_eBaseError;
\r
150 >> +extern VALUE notmuch_rb_eDatabaseError;
\r
151 >> +extern VALUE notmuch_rb_eMemoryError;
\r
152 >> +extern VALUE notmuch_rb_eReadOnlyError;
\r
153 >> +extern VALUE notmuch_rb_eXapianError;
\r
154 >> +extern VALUE notmuch_rb_eFileError;
\r
155 >> +extern VALUE notmuch_rb_eFileNotEmailError;
\r
156 >> +extern VALUE notmuch_rb_eNullPointerError;
\r
157 >> +extern VALUE notmuch_rb_eTagTooLongError;
\r
158 >> +extern VALUE notmuch_rb_eUnbalancedFreezeThawError;
\r
159 >> +extern VALUE notmuch_rb_eUnbalancedAtomicError;
\r
161 >> +extern ID ID_call;
\r
162 >> +extern ID ID_db_create;
\r
163 >> +extern ID ID_db_mode;
\r
167 >> =A0/* RSTRING_PTR() is new in ruby-1.9 */
\r
168 >> =A0#if !defined(RSTRING_PTR)
\r
169 >> diff --git a/bindings/ruby/init.c b/bindings/ruby/init.c
\r
170 >> index 3fe60fb..b2dc7f6 100644
\r
171 >> --- a/bindings/ruby/init.c
\r
172 >> +++ b/bindings/ruby/init.c
\r
173 >> @@ -18,7 +18,9 @@
\r
174 >> =A0 * Author: Ali Polatel <alip@exherbo.org>
\r
177 >> +#define RUBY_INIT_C
\r
178 >> =A0#include "defs.h"
\r
179 >> +#undef RUBY_INIT_C
\r
182 >> =A0 * Document-module: Notmuch
\r
183 > _______________________________________________
\r
184 > notmuch mailing list
\r
185 > notmuch@notmuchmail.org
\r
186 > http://notmuchmail.org/mailman/listinfo/notmuch
\r