From owner-freebsd-chat@FreeBSD.ORG Tue Apr 27 09:07:49 2004 Return-Path: Delivered-To: freebsd-chat@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8797A16A4CE for ; Tue, 27 Apr 2004 09:07:49 -0700 (PDT) Received: from mx.tele-kom.ru (mx.tele-kom.ru [213.80.148.6]) by mx1.FreeBSD.org (Postfix) with SMTP id E33D943D4C for ; Tue, 27 Apr 2004 09:07:47 -0700 (PDT) (envelope-from doublef@tele-kom.ru) Received: (qmail 14232 invoked by uid 555); 27 Apr 2004 20:07:46 +0400 Received: from shark (213.80.149.141) by t-k.ru with TeleMail/2 id 1083082065-14184 for cpressey@catseye.mine.nu; Tue, 27 Apr 20:07:45 2004 +0400 (MSD) Received: by shark (Postfix, from userid 1000) id 24A01218; Tue, 27 Apr 2004 20:07:37 +0400 (MSD) Date: Tue, 27 Apr 2004 20:07:37 +0400 From: Sergey Zaharchenko To: Dag-Erling =?utf-8?B?U23QrHJncmF2?= Message-ID: <20040427160737.GA1325@Shark.localdomain> References: <20040425215837.3f4708fe.cpressey@catseye.mine.nu> <20040426094335.GA7578@online.fr> <20040426115842.GA4144@Shark.localdomain> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="wac7ysb48OaltWcw" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i cc: Rahul Siddharthan cc: Chris Pressey cc: chat@freebsd.org Subject: Re: Beginning C++ in FreeBSD X-BeenThere: freebsd-chat@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Non technical items related to the community List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Apr 2004 16:07:49 -0000 --wac7ysb48OaltWcw Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 27, 2004 at 02:41:33PM +0200, Dag-Erling Sm=D0=ACrgrav probably wrote: > Sergey Zaharchenko writes: > > // Turing strikes again:) > > // Ok. Write this (to be compiled as a shared object) in portable C: > > > > #include > > > > class A > > { > > public: > > A(); > > }; > > > > A::A() > > { > > cout<<"This shared library was loaded!"< > } > > > > static A a; >=20 > Sure: >=20 > void a(void) > { > cout =3D endl =3D 0; > } >=20 > the error message won't be *exactly* the same, but pretty close > (different line numbers, and "In function `a'" instead of "In > constructor `A::A()'") >=20 Script started on Tue Apr 27 20:01:30 2004 df@Shark:~> cat >cc.cc #include class A { public: A(); }; A::A() { cout<<"This shared library was loaded!"< g++ cc.cc /usr/lib/crt1.o: In function `_start': /usr/lib/crt1.o(.text+0x82): undefined reference to `main' df@Shark:~> cat >c.c void a(void) { cout =3D endl =3D 0; } df@Shark:~> c89 c.c c.c: In function `a': c.c:3: `cout' undeclared (first use in this function) c.c:3: (Each undeclared identifier is reported only once c.c:3: for each function it appears in.) c.c:3: `endl' undeclared (first use in this function) df@Shark:~> df@Shark:~> exit exit Script done on Tue Apr 27 20:03:34 2004 Sorry? I mean, you've got the object file, and can compile a shared library which will advertize itself, with the former, whereas the latter, as you've pointed out, doesn't compile. A quick hint: Turing has nothing to do with all this... --=20 DoubleF Bare feet magnetize sharp metal objects so they point upward from the floor -- especially in the dark. --wac7ysb48OaltWcw Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFAjoVIwo7hT/9lVdwRAqNHAJ0SF7hC4f1dzYw9snUuGHxwSi6sawCfX/os Kt0bQtay0j+yfEPYUSyIAPc= =QLPt -----END PGP SIGNATURE----- --wac7ysb48OaltWcw--