From owner-freebsd-questions Mon Mar 11 4:10: 4 2002 Delivered-To: freebsd-questions@freebsd.org Received: from web.delfi.lv (web.delfi.lv [195.2.123.21]) by hub.freebsd.org (Postfix) with ESMTP id EDD8A37B405 for ; Mon, 11 Mar 2002 04:09:54 -0800 (PST) Received: from viktors [195.2.123.104] by web.delfi.lv (SMTPD32-6.06) id AF36867024C; Mon, 11 Mar 2002 14:12:38 +0200 Message-ID: <000e01c1c8f6$1fd928c0$687b02c3@viktors> From: "Viktors Krebss" To: Subject: Advanced FreeBSD programming question Date: Mon, 11 Mar 2002 14:13:16 +0200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_000B_01C1C906.E3512FE0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This is a multi-part message in MIME format. ------=_NextPart_000_000B_01C1C906.E3512FE0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello. =20 I have a question for a freebsd C/C++ developer guru, I guess.=20 Recently I've moved from Linux to Freebsd. I have noticed that some of my C programs behave different, even quite simple ones ,100% POSIX / ANSI and working with very simple types ( no sockets, no=20 devices, signals or anything like that ).=20 Looks like it has a bit different memory management or I'm just missing=20 some compiler or linker option.=20 For instance: Let's say I have two shared libraries libA.so and libB.so . A has function x(), and pointer to that function *x, B - y() and *y . All of them are global. Than, at runtime A has to load B . B is assigning y to x. In Linux and WINNT it works fine. But not in freebsd, although there are no warnings from gcc ( with -Wall option ).=20 When B is loaded ,x , in B context, always is 0 and nothing can affect x in A context from B. However, in case when A compiled as executable and B as shared library it woks fine for freebsd to. =20 i686 ( celeron ) , FreeBSD 4.3 , gcc. Best regards, Viktors Krebss, victor@smc.lv SMC , http://www.smc.lv/ tel: +371-7777750, mob: +371-9243923, fax: +371-7777746 ------=_NextPart_000_000B_01C1C906.E3512FE0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
  Hello.
 
I have a question for a freebsd C/C++ = developer=20 guru, I guess.

Recently I=92ve moved from Linux to Freebsd. I = have=20 noticed

that some of my C programs behave different, even = quite=20 simple ones

,100% POSIX / ANSI and working with very simple = types=20 ( no sockets, no

devices, signals or anything like that ). =

Looks like it has a bit different memory management = or I=92m=20 just missing

some compiler or linker option.

For instance:

Let=92s say I have two shared libraries libA.so and = libB.so=20 .

A has function x(), and pointer to that function = *x,

B =96 y() and *y . All of them are global.

Than, at runtime A has to load B . B = is assigning y=20 to x.

In Linux and WINNT it works fine. But not in = freebsd,=20 although there

are no warnings from gcc ( with -Wall = option ).=20

When B is loaded ,x , in B context, always is 0 and = nothing

can affect x=20 in A context from B.

However, in case when A compiled as executable and = B as=20 shared

library it woks fine for freebsd to.    

i686 ( celeron ) , FreeBSD 4.3 = , gcc.

 
Best regards,
Viktors Krebss, victor@smc.lv
SMC , http://www.smc.lv/
tel: +371-7777750, = mob:=20 +371-9243923, fax: +371-7777746
------=_NextPart_000_000B_01C1C906.E3512FE0-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message