Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Mar 2002 14:13:16 +0200
From:      "Viktors Krebss" <victor@smc.lv>
To:        <questions@FreeBSD.org>
Subject:   Advanced FreeBSD programming question
Message-ID:  <000e01c1c8f6$1fd928c0$687b02c3@viktors>

next in thread | raw e-mail | index | archive | help
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

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4913.1100" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2><FONT face=3D"Times New Roman"=20
size=3D3>&nbsp;</FONT>&nbsp;Hello.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><FONT face=3D"Times New Roman"=20
size=3D3>&nbsp;</FONT></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I have a question for a freebsd C/C++ =
developer=20
guru, I guess. </DIV>
<P class=3DMsoNormal>Recently I=92ve moved from Linux to Freebsd.&nbsp;I =
have=20
noticed</P>
<P class=3DMsoNormal>that some of my C programs behave different, even =
quite=20
simple ones</P>
<P class=3DMsoNormal>,100% POSIX / ANSI and working with very simple =
types=20
(&nbsp;no sockets, no </P>
<P class=3DMsoNormal>devices, signals&nbsp;or anything like that&nbsp;). =
</P>
<P class=3DMsoNormal>Looks like it has a bit different memory management =
or I=92m=20
just missing </P>
<P class=3DMsoNormal>some compiler or linker option. </P>
<P class=3DMsoNormal>For instance:</P>
<P class=3DMsoNormal>Let=92s say I have two shared libraries libA.so and =
libB.so=20
.</P>
<P class=3DMsoNormal>A has function x(), and pointer to that function =
*x,</P>
<P class=3DMsoNormal>B =96 y() and *y . All of them are global.</P>
<P class=3DMsoNormal>Than, at runtime A has to load B . B =
is&nbsp;assigning&nbsp;y=20
to x.</P>
<P class=3DMsoNormal>In Linux and&nbsp;WINNT it works fine. But not in =
freebsd,=20
although there</P>
<P class=3DMsoNormal>are no warnings from gcc (&nbsp;with -Wall =
option&nbsp;).=20
</P>
<P class=3DMsoNormal>When B is loaded ,x , in B context, always is 0 and =

nothing</P>
<P class=3DMsoNormal>can&nbsp;affect<SPAN style=3D"mso-spacerun: =
yes">&nbsp;</SPAN>x=20
in A context from B.</P>
<P class=3DMsoNormal>However, in case when A compiled as executable and =
B as=20
shared</P>
<P class=3DMsoNormal>library it woks fine for freebsd to.<SPAN=20
style=3D"mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></P>
<P class=3DMsoNormal>i686 (&nbsp;celeron ) , FreeBSD 4.3 =
,&nbsp;gcc.</P></FONT>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Best regards,<BR>Viktors Krebss, <A=20
href=3D"mailto:victor@smc.lv">victor@smc.lv</A><BR>SMC , <A=20
href=3D"http://www.smc.lv/">http://www.smc.lv/</A><BR>tel: +371-7777750, =
mob:=20
+371-9243923, fax: +371-7777746<BR></FONT></DIV></BODY></HTML>

------=_NextPart_000_000B_01C1C906.E3512FE0--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?000e01c1c8f6$1fd928c0$687b02c3>