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

[-- Attachment #1 --]
  Hello.
 
I have a question for a freebsd C/C++ developer guru, I guess. 
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 

devices, signals or anything like that ). 

Looks like it has a bit different memory management or I'm just missing 

some compiler or linker option. 

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 ). 

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.     

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

[-- Attachment #2 --]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 5.50.4913.1100" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2><FONT face="Times New Roman" 
size=3>&nbsp;</FONT>&nbsp;Hello.</FONT></DIV>
<DIV><FONT face=Arial size=2><FONT face="Times New Roman" 
size=3>&nbsp;</FONT></FONT></DIV>
<DIV><FONT face=Arial size=2>I have a question for a freebsd C/C++ developer 
guru, I guess. </DIV>
<P class=MsoNormal>Recently I’ve moved from Linux to Freebsd.&nbsp;I have 
noticed</P>
<P class=MsoNormal>that some of my C programs behave different, even quite 
simple ones</P>
<P class=MsoNormal>,100% POSIX / ANSI and working with very simple types 
(&nbsp;no sockets, no </P>
<P class=MsoNormal>devices, signals&nbsp;or anything like that&nbsp;). </P>
<P class=MsoNormal>Looks like it has a bit different memory management or I’m 
just missing </P>
<P class=MsoNormal>some compiler or linker option. </P>
<P class=MsoNormal>For instance:</P>
<P class=MsoNormal>Let’s say I have two shared libraries libA.so and libB.so 
.</P>
<P class=MsoNormal>A has function x(), and pointer to that function *x,</P>
<P class=MsoNormal>B – y() and *y . All of them are global.</P>
<P class=MsoNormal>Than, at runtime A has to load B . B is&nbsp;assigning&nbsp;y 
to x.</P>
<P class=MsoNormal>In Linux and&nbsp;WINNT it works fine. But not in freebsd, 
although there</P>
<P class=MsoNormal>are no warnings from gcc (&nbsp;with -Wall option&nbsp;). 
</P>
<P class=MsoNormal>When B is loaded ,x , in B context, always is 0 and 
nothing</P>
<P class=MsoNormal>can&nbsp;affect<SPAN style="mso-spacerun: yes">&nbsp;</SPAN>x 
in A context from B.</P>
<P class=MsoNormal>However, in case when A compiled as executable and B as 
shared</P>
<P class=MsoNormal>library it woks fine for freebsd to.<SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></P>
<P class=MsoNormal>i686 (&nbsp;celeron ) , FreeBSD 4.3 ,&nbsp;gcc.</P></FONT>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Best regards,<BR>Viktors Krebss, <A 
href="mailto:victor@smc.lv">victor@smc.lv</A><BR>SMC , <A 
href="http://www.smc.lv/">http://www.smc.lv/</A><BR>tel: +371-7777750, mob: 
+371-9243923, fax: +371-7777746<BR></FONT></DIV></BODY></HTML>

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