1 Return-Path: <tomi.ollila@iki.fi>
\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 69082431FAF
\r
6 for <notmuch@notmuchmail.org>; Tue, 8 May 2012 13:13:35 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id S1fK85hwqvwY for <notmuch@notmuchmail.org>;
\r
16 Tue, 8 May 2012 13:13:34 -0700 (PDT)
\r
17 Received: from guru.guru-group.fi (guru-group.fi [87.108.86.66])
\r
18 by olra.theworths.org (Postfix) with ESMTP id EC952431FAE
\r
19 for <notmuch@notmuchmail.org>; Tue, 8 May 2012 13:13:33 -0700 (PDT)
\r
20 Received: by guru.guru-group.fi (Postfix, from userid 501)
\r
21 id 2DE6868021; Tue, 8 May 2012 23:13:28 +0300 (EEST)
\r
22 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
23 To: Charlie Allom <charlie@mediasp.com>, notmuch@notmuchmail.org,
\r
24 Ali Polatel <alip@exherbo.org>
\r
25 Subject: Re: [PATCH] ruby: extern values in ruby defs.h
\r
26 In-Reply-To: <1336481467-66356-1-git-send-email-charlie@mediasp.com>
\r
27 References: <1336481467-66356-1-git-send-email-charlie@mediasp.com>
\r
28 User-Agent: Notmuch/0.12+181~g650dcc2 (http://notmuchmail.org) Emacs/23.3.1
\r
29 (x86_64-unknown-linux-gnu)
\r
30 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL
\r
31 $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F
\r
32 !)g;OY^,BjTbr)Np:%c_o'jj,Z
\r
33 Date: Tue, 08 May 2012 23:13:28 +0300
\r
34 Message-ID: <m262c6ctxz.fsf@guru.guru-group.fi>
\r
36 Content-Type: text/plain; charset=us-ascii
\r
37 X-BeenThere: notmuch@notmuchmail.org
\r
38 X-Mailman-Version: 2.1.13
\r
40 List-Id: "Use and development of the notmuch mail system."
\r
41 <notmuch.notmuchmail.org>
\r
42 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
43 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
44 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
45 List-Post: <mailto:notmuch@notmuchmail.org>
\r
46 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
47 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
48 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
49 X-List-Received-Date: Tue, 08 May 2012 20:13:35 -0000
\r
51 On Tue, May 08 2012, Charlie Allom <charlie@mediasp.com> wrote:
\r
53 > Currently, building on OSX complains about linking duplicate symbols. This
\r
57 I just spent some time looking out this declaration/definition thing --
\r
58 it is not easy to find proper documentation...
\r
60 Finally, I was reading this:
\r
62 http://www.open-std.org/jtc1/sc22/wg14/www/docs/C99RationaleV5.10.pdf
\r
64 (warning (goatse class), pdf converted from word document ;)
\r
66 At the end of page 33 is interesting (also beginning of 34 and it is good
\r
67 to start from middle of page 32)
\r
69 Those mention 4 different way 'external linkage' is handled in pre-89
\r
72 Standards-compliant (c99, at least) compilers should handle this is
\r
73 a combination of 'Strict Ref/Def' and 'Initialization' model. IIUC this
\r
74 means that if variable is defined (I mean declared) as
\r
78 It is a tentative definition; There can be many of these seen by c compiler
\r
79 while compiling c files and when linking is done there will be one storage
\r
80 allocated for this variable. There can be (at most) one definition like
\r
84 in source code, even another 'int i = 0;' is not allowed according to
\r
85 the standard -- some compilers may make this work (and even the case where
\r
86 there is 'int i = 1;')
\r
88 But, there are also compilers that only allow 'Strict Ref/Def' model; IIUC
\r
89 then there can be only one 'int i;' (or 'int i = 0;') -- and all others
\r
90 (declarations) needs to be in format 'extern int i;'. The 'Strict Ref/Def'
\r
91 model is the model specified in K&R.
\r
93 All of that said, LGTM!
\r
97 > bindings/ruby/defs.h | 46 +++++++++++++++++++++++-----------------------
\r
98 > 1 files changed, 23 insertions(+), 23 deletions(-)
\r
100 > diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h
\r
101 > index 81f652f..bd124cc 100644
\r
102 > --- a/bindings/ruby/defs.h
\r
103 > +++ b/bindings/ruby/defs.h
\r
104 > @@ -24,31 +24,31 @@
\r
105 > #include <notmuch.h>
\r
106 > #include <ruby.h>
\r
108 > -VALUE notmuch_rb_cDatabase;
\r
109 > -VALUE notmuch_rb_cDirectory;
\r
110 > -VALUE notmuch_rb_cFileNames;
\r
111 > -VALUE notmuch_rb_cQuery;
\r
112 > -VALUE notmuch_rb_cThreads;
\r
113 > -VALUE notmuch_rb_cThread;
\r
114 > -VALUE notmuch_rb_cMessages;
\r
115 > -VALUE notmuch_rb_cMessage;
\r
116 > -VALUE notmuch_rb_cTags;
\r
118 > -VALUE notmuch_rb_eBaseError;
\r
119 > -VALUE notmuch_rb_eDatabaseError;
\r
120 > -VALUE notmuch_rb_eMemoryError;
\r
121 > -VALUE notmuch_rb_eReadOnlyError;
\r
122 > -VALUE notmuch_rb_eXapianError;
\r
123 > -VALUE notmuch_rb_eFileError;
\r
124 > -VALUE notmuch_rb_eFileNotEmailError;
\r
125 > -VALUE notmuch_rb_eNullPointerError;
\r
126 > -VALUE notmuch_rb_eTagTooLongError;
\r
127 > -VALUE notmuch_rb_eUnbalancedFreezeThawError;
\r
128 > -VALUE notmuch_rb_eUnbalancedAtomicError;
\r
131 > -ID ID_db_create;
\r
133 > +extern VALUE notmuch_rb_cDatabase;
\r
134 > +extern VALUE notmuch_rb_cDirectory;
\r
135 > +extern VALUE notmuch_rb_cFileNames;
\r
136 > +extern VALUE notmuch_rb_cQuery;
\r
137 > +extern VALUE notmuch_rb_cThreads;
\r
138 > +extern VALUE notmuch_rb_cThread;
\r
139 > +extern VALUE notmuch_rb_cMessages;
\r
140 > +extern VALUE notmuch_rb_cMessage;
\r
141 > +extern VALUE notmuch_rb_cTags;
\r
143 > +extern VALUE notmuch_rb_eBaseError;
\r
144 > +extern VALUE notmuch_rb_eDatabaseError;
\r
145 > +extern VALUE notmuch_rb_eMemoryError;
\r
146 > +extern VALUE notmuch_rb_eReadOnlyError;
\r
147 > +extern VALUE notmuch_rb_eXapianError;
\r
148 > +extern VALUE notmuch_rb_eFileError;
\r
149 > +extern VALUE notmuch_rb_eFileNotEmailError;
\r
150 > +extern VALUE notmuch_rb_eNullPointerError;
\r
151 > +extern VALUE notmuch_rb_eTagTooLongError;
\r
152 > +extern VALUE notmuch_rb_eUnbalancedFreezeThawError;
\r
153 > +extern VALUE notmuch_rb_eUnbalancedAtomicError;
\r
155 > +extern ID ID_call;
\r
156 > +extern ID ID_db_create;
\r
157 > +extern ID ID_db_mode;
\r
159 > /* RSTRING_PTR() is new in ruby-1.9 */
\r
160 > #if !defined(RSTRING_PTR)
\r
164 > _______________________________________________
\r
165 > notmuch mailing list
\r
166 > notmuch@notmuchmail.org
\r
167 > http://notmuchmail.org/mailman/listinfo/notmuch
\r