RE: compiling g++ 3.2.3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi guys

This is the first time I'm porting my code from Linux to AIX, thankyou very
much for your greate support. I still have another problem porting my
software to AIX. On Linux, I use ioctl to get the hardware address  of my
network card : ioctl(mySocket, SIOCGIFHWADDR, (char *)wInfo); and the
hardware address is returned in wInfo->ifr_hwaddr.sa_data[0] (wInfo is a
pointer to ifreq structure). On AIX, ifr_hwaddr is not part of ifreq
anymore, is there another way to get the hardware address on AIX

Thanks & Regards

Long Phan


-----Original Message-----
From: David Edelsohn [mailto:dje@xxxxxxxxxxxxxx]
Sent: Monday, June 21, 2004 3:54 PM
To: lrtaylor@xxxxxxxxxx; longp@xxxxxxx
Cc: gcc-help@xxxxxxxxxxx
Subject: Re: compiling g++ 3.2.3 


>>>>> lrtaylor  writes:

Lyle> Actually, AIX has three library concepts or types on the Power
platform
Lyle> rather than the traditional two.  There are static libraries (which
are
Lyle> .a archive files just like those you see on many other UNIX
platforms),
Lyle> shared libraries (which are special .a archive files that are built in
Lyle> such as way as to be linked in dynamically at run time - as opposed to
Lyle> statically like normal .a files are), and shared objects (the
Lyle> traditional .so file).  The terms "shared library" and "shared object"
Lyle> are not synonymous on AIX like they essentially are on many other UNIX
Lyle> platforms.

	AIX treats shared libraries (an archive of shared objects) and
shared objects the same.  An executable or shared object depends on a
shared object archive member of the shared library.  The shared library
may contain both shared objects and non-shared objects.

	".so" file extension and shared object are completely separate and
orthogonal concepts.  On AIX, a shared object can have any file extension.
The AIX linker only recognizes certain extensions when one does not refer
to the entire filename (e.g., -lfoo).  On AIX, ".so" file extension
normally corresponds to shared objects with the additional semantics of
runtime linking for compatibility with other Unixes.  A shared object can
be named shr.o or libfoo.a or libbar.so, for example.  The ".so" file
extension is a convention on AIX but does not itself imply any different
semantics. 

Lyle> AIX links to libraries ending in .a by default.  This does not mean
that
Lyle> it is linking statically by default, unless the library it finds is a
Lyle> static library. In order to tell the linker to link to .so files by
Lyle> default, you need to specify the -brtl option (for run-time linking as
Lyle> they call it).  That's the option that is passed to IBM's VisualAge
Lyle> compiler, so I don't know if GCC recognizes it.  If it doesn't, then
you
Lyle> might try '-Wl,-brtl'.

	-brtl tells the linker to look for ".so" file extension as well
and changes the semantics to runtime linking, but ".so" does not mean
runtime linking unless the developer follows the naming conventions.

	GCC does not require runtime linking.  GCC libstdc++ is built
runtime linking ready (with -G option), but applications do not link using
-brtl by default.  It only helps in corner cases (like user overriding
new[] operator). 

	One can add -Wl,-brtl to GCC link line and it will work, but it is
better to avoid those semantics unless needed.

	The AIX command

$ dump -H <filename>

prints the shared library dependencies and will show if the library was
linked shared.

	Bottom line: ".a" file extension does not mean static linking.

David

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux